<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1999
-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE RecordWildCards #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Instance.Typeable</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkTypeableBinds"><span class="hs-identifier">mkTypeableBinds</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#tyConIsTypeable"><span class="hs-identifier">tyConIsTypeable</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-17"></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Boxity"><span class="hs-identifier">Boxity</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#neverInlinePragma"><span class="hs-identifier">neverInlinePragma</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#SourceText"><span class="hs-identifier">SourceText</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Env.html"><span class="hs-identifier">GHC.Iface.Env</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Iface.Env.html#newGlobalBinder"><span class="hs-identifier">newGlobalBinder</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html"><span class="hs-identifier">GHC.Core.TyCo.Rep</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier">Type</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyLit"><span class="hs-identifier">TyLit</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Env.html"><span class="hs-identifier">GHC.Tc.Utils.Env</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html"><span class="hs-identifier">GHC.Tc.Types.Evidence</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#mkWpTyApps"><span class="hs-identifier">mkWpTyApps</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#lookupId"><span class="hs-identifier">lookupId</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html"><span class="hs-identifier">GHC.Builtin.Types.Prim</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html#primTyCons"><span class="hs-identifier">primTyCons</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span>
</span><span id="line-29"></span><span>                  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#tupleTyCon"><span class="hs-identifier">tupleTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#sumTyCon"><span class="hs-identifier">sumTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#runtimeRepTyCon"><span class="hs-identifier">runtimeRepTyCon</span></a></span><span>
</span><span id="line-30"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#vecCountTyCon"><span class="hs-identifier">vecCountTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#vecElemTyCon"><span class="hs-identifier">vecElemTyCon</span></a></span><span>
</span><span id="line-31"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#nilDataCon"><span class="hs-identifier">nilDataCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#consDataCon"><span class="hs-identifier">consDataCon</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#VarBndr"><span class="hs-identifier">VarBndr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Map.html"><span class="hs-identifier">GHC.Core.Map</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Settings.Constants.html"><span class="hs-identifier">GHC.Settings.Constants</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Fingerprint.html"><span class="hs-identifier">GHC.Utils.Fingerprint</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Fingerprint.Type.html#Fingerprint"><span class="hs-identifier">Fingerprint</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Fingerprint.html#fingerprintString"><span class="hs-identifier">fingerprintString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Fingerprint.html#fingerprintFingerprints"><span class="hs-identifier">fingerprintFingerprints</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier">FastString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier">mkFastString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier">fsLit</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.State.html#"><span class="hs-identifier">Control.Monad.Trans.State</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Class.html#"><span class="hs-identifier">Control.Monad.Trans.Class</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.Class.html#lift"><span class="hs-identifier">lift</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier">isJust</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Word.html#"><span class="hs-identifier">Data.Word</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word64"><span class="hs-identifier">Word64</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span>
</span><span id="line-53"></span><span class="hs-comment">{- Note [Grand plan for Typeable]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The overall plan is this:

1. Generate a binding for each module p:M
   (done in GHC.Tc.Instance.Typeable by mkModIdBindings)
       M.$trModule :: GHC.Unit.Module
       M.$trModule = Module &quot;p&quot; &quot;M&quot;
   (&quot;tr&quot; is short for &quot;type representation&quot;; see GHC.Types)

   We might want to add the filename too.
   This can be used for the lightweight stack-tracing stuff too

   Record the Name M.$trModule in the tcg_tr_module field of TcGblEnv

2. Generate a binding for every data type declaration T in module M,
       M.$tcT :: GHC.Types.TyCon
       M.$tcT = TyCon ...fingerprint info...
                      $trModule
                      &quot;T&quot;
                      0#
                      kind_rep

   Here 0# is the number of arguments expected by the tycon to fully determine
   its kind. kind_rep is a value of type GHC.Types.KindRep, which gives a
   recipe for computing the kind of an instantiation of the tycon (see
   Note [Representing TyCon kinds: KindRep] later in this file for details).

   We define (in GHC.Core.TyCon)

        type TyConRepName = Name

   to use for these M.$tcT &quot;tycon rep names&quot;. Note that these must be
   treated as &quot;never exported&quot; names by Backpack (see
   Note [Handling never-exported TyThings under Backpack]). Consequently
   they get slightly special treatment in GHC.Iface.Rename.rnIfaceDecl.

3. Record the TyConRepName in T's TyCon, including for promoted
   data and type constructors, and kinds like * and #.

   The TyConRepName is not an &quot;implicit Id&quot;.  It's more like a record
   selector: the TyCon knows its name but you have to go to the
   interface file to find its type, value, etc

4. Solve Typeable constraints.  This is done by a custom Typeable solver,
   currently in GHC.Tc.Solver.Interact, that use M.$tcT so solve (Typeable T).

There are many wrinkles:

* The timing of when we produce this bindings is rather important: they must be
  defined after the rest of the module has been typechecked since we need to be
  able to lookup Module and TyCon in the type environment and we may be
  currently compiling GHC.Types (where they are defined).

* GHC.Prim doesn't have any associated object code, so we need to put the
  representations for types defined in this module elsewhere. We chose this
  place to be GHC.Types. GHC.Tc.Instance.Typeable.mkPrimTypeableBinds is responsible for
  injecting the bindings for the GHC.Prim representions when compiling
  GHC.Types.

* TyCon.tyConRepModOcc is responsible for determining where to find
  the representation binding for a given type. This is where we handle
  the special case for GHC.Prim.

* To save space and reduce dependencies, we need use quite low-level
  representations for TyCon and Module.  See GHC.Types
  Note [Runtime representation of modules and tycons]

* The KindReps can unfortunately get quite large. Moreover, the simplifier will
  float out various pieces of them, resulting in numerous top-level bindings.
  Consequently we mark the KindRep bindings as noinline, ensuring that the
  float-outs don't make it into the interface file. This is important since
  there is generally little benefit to inlining KindReps and they would
  otherwise strongly affect compiler performance.

* In general there are lots of things of kind *, * -&gt; *, and * -&gt; * -&gt; *. To
  reduce the number of bindings we need to produce, we generate their KindReps
  once in GHC.Types. These are referred to as &quot;built-in&quot; KindReps below.

* Even though KindReps aren't inlined, this scheme still has more of an effect on
  compilation time than I'd like. This is especially true in the case of
  families of type constructors (e.g. tuples and unboxed sums). The problem is
  particularly bad in the case of sums, since each arity-N tycon brings with it
  N promoted datacons, each with a KindRep whose size also scales with N.
  Consequently we currently simply don't allow sums to be Typeable.

  In general we might consider moving some or all of this generation logic back
  to the solver since the performance hit we take in doing this at
  type-definition time is non-trivial and Typeable isn't very widely used. This
  is discussed in #13261.

-}</span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span class="hs-comment">-- | Generate the Typeable bindings for a module. This is the only</span><span>
</span><span id="line-147"></span><span class="hs-comment">-- entry-point of this module and is invoked by the typechecker driver in</span><span>
</span><span id="line-148"></span><span class="hs-comment">-- 'tcRnSrcDecls'.</span><span>
</span><span id="line-149"></span><span class="hs-comment">--</span><span>
</span><span id="line-150"></span><span class="hs-comment">-- See Note [Grand plan for Typeable] in &quot;GHC.Tc.Instance.Typeable&quot;.</span><span>
</span><span id="line-151"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkTypeableBinds"><span class="hs-identifier hs-type">mkTypeableBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span>
</span><span id="line-152"></span><span id="mkTypeableBinds"><span class="annot"><span class="annottext">mkTypeableBinds :: TcM TcGblEnv
</span><a href="GHC.Tc.Instance.Typeable.html#mkTypeableBinds"><span class="hs-identifier hs-var hs-var">mkTypeableBinds</span></a></span></span><span>
</span><span id="line-153"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681106687"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681106687"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-154"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">GeneralFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#gopt"><span class="hs-identifier hs-var">gopt</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_NoTypeableBinds"><span class="hs-identifier hs-var">Opt_NoTypeableBinds</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681106687"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">TcM TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-155"></span><span>       </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- Create a binding for $trModule.</span><span>
</span><span id="line-156"></span><span>         </span><span class="hs-comment">-- Do this before processing any data type declarations,</span><span>
</span><span id="line-157"></span><span>         </span><span class="hs-comment">-- which need tcg_tr_module to be initialised</span><span>
</span><span id="line-158"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106682"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106682"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM TcGblEnv
</span><a href="GHC.Tc.Instance.Typeable.html#mkModIdBindings"><span class="hs-identifier hs-var">mkModIdBindings</span></a></span><span>
</span><span id="line-159"></span><span>         </span><span class="hs-comment">-- Now we can generate the TyCon representations...</span><span>
</span><span id="line-160"></span><span>         </span><span class="hs-comment">-- First we handle the primitive TyCons if we are compiling GHC.Types</span><span>
</span><span id="line-161"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106680"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106680"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106679"><span class="annot"><span class="annottext">[TypeRepTodo]
</span><a href="#local-6989586621681106679"><span class="hs-identifier hs-var">prim_todos</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
-&gt; TcRnIf TcGblEnv TcLclEnv (TcGblEnv, [TypeRepTodo])
-&gt; TcRnIf TcGblEnv TcLclEnv (TcGblEnv, [TypeRepTodo])
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106682"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv (TcGblEnv, [TypeRepTodo])
</span><a href="GHC.Tc.Instance.Typeable.html#mkPrimTypeableTodos"><span class="hs-identifier hs-var">mkPrimTypeableTodos</span></a></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>         </span><span class="hs-comment">-- Then we produce bindings for the user-defined types in this module.</span><span>
</span><span id="line-164"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcM TcGblEnv -&gt; TcM TcGblEnv
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106680"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM TcGblEnv -&gt; TcM TcGblEnv) -&gt; TcM TcGblEnv -&gt; TcM TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-165"></span><span>    </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681106676"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106676"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) Module
forall (m :: * -&gt; *). HasModule m =&gt; m Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var">getModule</span></a></span><span>
</span><span id="line-166"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106674"><span class="annot"><span class="annottext">tycons :: [TyCon]
</span><a href="#local-6989586621681106674"><span class="hs-identifier hs-var hs-var">tycons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Bool) -&gt; [TyCon] -&gt; [TyCon]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="#local-6989586621681106673"><span class="hs-identifier hs-var">needs_typeable_binds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv -&gt; [TyCon]
</span><a href="GHC.Tc.Types.html#tcg_tcs"><span class="hs-identifier hs-var hs-var">tcg_tcs</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106680"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-167"></span><span>             </span><span id="local-6989586621681106671"><span class="annot"><span class="annottext">mod_id :: Var
</span><a href="#local-6989586621681106671"><span class="hs-identifier hs-var hs-var">mod_id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; Maybe Var
</span><a href="GHC.Tc.Types.html#tcg_tr_module"><span class="hs-identifier hs-var hs-var">tcg_tr_module</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106680"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-keyword">of</span><span>  </span><span class="hs-comment">-- Should be set by now</span><span>
</span><span id="line-168"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681106669"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106669"><span class="hs-identifier hs-var">mod_id</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106669"><span class="hs-identifier hs-var">mod_id</span></a></span><span>
</span><span id="line-169"></span><span>                        </span><span class="annot"><span class="annottext">Maybe Var
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Var
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcMkTypeableBinds&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyCon] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCon]
</span><a href="#local-6989586621681106674"><span class="hs-identifier hs-var">tycons</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-170"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkTypeableBinds&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyCon] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCon]
</span><a href="#local-6989586621681106674"><span class="hs-identifier hs-var">tycons</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-171"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106665"><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106665"><span class="hs-identifier hs-var">this_mod_todos</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Module -&gt; Var -&gt; [TyCon] -&gt; TcM TypeRepTodo
</span><a href="GHC.Tc.Instance.Typeable.html#todoForTyCons"><span class="hs-identifier hs-var">todoForTyCons</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106676"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106671"><span class="hs-identifier hs-var">mod_id</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCon]
</span><a href="#local-6989586621681106674"><span class="hs-identifier hs-var">tycons</span></a></span><span>
</span><span id="line-172"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[TypeRepTodo] -&gt; TcM TcGblEnv
</span><a href="GHC.Tc.Instance.Typeable.html#mkTypeRepTodoBinds"><span class="hs-identifier hs-var">mkTypeRepTodoBinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106665"><span class="hs-identifier hs-var">this_mod_todos</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo -&gt; [TypeRepTodo] -&gt; [TypeRepTodo]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[TypeRepTodo]
</span><a href="#local-6989586621681106679"><span class="hs-identifier hs-var">prim_todos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span>       </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-174"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-175"></span><span>    </span><span id="local-6989586621681106673"><span class="annot"><span class="annottext">needs_typeable_binds :: TyCon -&gt; Bool
</span><a href="#local-6989586621681106673"><span class="hs-identifier hs-var hs-var">needs_typeable_binds</span></a></span></span><span> </span><span id="local-6989586621681106659"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106659"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-176"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106659"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyCon] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#runtimeRepTyCon"><span class="hs-identifier hs-var">runtimeRepTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#vecCountTyCon"><span class="hs-identifier hs-var">vecCountTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#vecElemTyCon"><span class="hs-identifier hs-var">vecElemTyCon</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-177"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-178"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-179"></span><span>          </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isAlgTyCon"><span class="hs-identifier hs-var">isAlgTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106659"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-180"></span><span>       </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isDataFamilyTyCon"><span class="hs-identifier hs-var">isDataFamilyTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106659"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-181"></span><span>       </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isClassTyCon"><span class="hs-identifier hs-var">isClassTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106659"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-182"></span><span>
</span><span id="line-183"></span><span>
</span><span id="line-184"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
            Building top-level binding for $trModule
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkModIdBindings"><span class="hs-identifier hs-type">mkModIdBindings</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span>
</span><span id="line-191"></span><span id="mkModIdBindings"><span class="annot"><span class="annottext">mkModIdBindings :: TcM TcGblEnv
</span><a href="GHC.Tc.Instance.Typeable.html#mkModIdBindings"><span class="hs-identifier hs-var hs-var">mkModIdBindings</span></a></span></span><span>
</span><span id="line-192"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681106653"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106653"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) Module
forall (m :: * -&gt; *). HasModule m =&gt; m Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var">getModule</span></a></span><span>
</span><span id="line-193"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106652"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681106652"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRn SrcSpan
</span><a href="GHC.Tc.Utils.Monad.html#getSrcSpanM"><span class="hs-identifier hs-var">getSrcSpanM</span></a></span><span>
</span><span id="line-194"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106650"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106650"><span class="hs-identifier hs-var">mod_nm</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Module -&gt; OccName -&gt; SrcSpan -&gt; TcRnIf TcGblEnv TcLclEnv Name
forall a b. Module -&gt; OccName -&gt; SrcSpan -&gt; TcRnIf a b Name
</span><a href="GHC.Iface.Env.html#newGlobalBinder"><span class="hs-identifier hs-var">newGlobalBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106653"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkVarOcc"><span class="hs-identifier hs-var">mkVarOcc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;$trModule&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681106652"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-195"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106648"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106648"><span class="hs-identifier hs-var">trModuleTyCon</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#trModuleTyConName"><span class="hs-identifier hs-var">trModuleTyConName</span></a></span><span>
</span><span id="line-196"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106645"><span class="annot"><span class="annottext">mod_id :: Var
</span><a href="#local-6989586621681106645"><span class="hs-identifier hs-var hs-var">mod_id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Kind -&gt; Var
</span><a href="GHC.Types.Id.html#mkExportedVanillaId"><span class="hs-identifier hs-var">mkExportedVanillaId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106650"><span class="hs-identifier hs-var">mod_nm</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Kind] -&gt; Kind
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106648"><span class="hs-identifier hs-var">trModuleTyCon</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106642"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106642"><span class="hs-identifier hs-var">mod_bind</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsBind (GhcPass 'Typechecked)
forall (p :: Pass).
IdP (GhcPass p) -&gt; LHsExpr (GhcPass p) -&gt; LHsBind (GhcPass p)
</span><a href="GHC.Hs.Utils.html#mkVarBind"><span class="hs-identifier hs-var">mkVarBind</span></a></span><span> </span><span class="annot"><span class="annottext">Var
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106645"><span class="hs-identifier hs-var">mod_id</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked) -&gt; LHsBind (GhcPass 'Typechecked))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsBind (GhcPass 'Typechecked))
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Module
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkModIdRHS"><span class="hs-identifier hs-var">mkModIdRHS</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106653"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106638"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106638"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; TcM TcGblEnv -&gt; TcM TcGblEnv
forall a. [Var] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendGlobalValEnv"><span class="hs-identifier hs-var">tcExtendGlobalValEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106645"><span class="hs-identifier hs-var">mod_id</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">TcM TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-200"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcM TcGblEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106638"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcg_tr_module :: Maybe Var
</span><a href="GHC.Tc.Types.html#tcg_tr_module"><span class="hs-identifier hs-var">tcg_tr_module</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Maybe Var
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106645"><span class="hs-identifier hs-var">mod_id</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-201"></span><span>                 </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [LHsBinds (GhcPass 'Typechecked)] -&gt; TcGblEnv
</span><a href="GHC.Tc.Utils.Env.html#addTypecheckedBinds"><span class="hs-operator hs-var">`addTypecheckedBinds`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Typechecked) -&gt; LHsBinds (GhcPass 'Typechecked)
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106642"><span class="hs-identifier hs-var">mod_bind</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkModIdRHS"><span class="hs-identifier hs-type">mkModIdRHS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-204"></span><span id="mkModIdRHS"><span class="annot"><span class="annottext">mkModIdRHS :: Module
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkModIdRHS"><span class="hs-identifier hs-var hs-var">mkModIdRHS</span></a></span></span><span> </span><span id="local-6989586621681106633"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106633"><span class="hs-identifier hs-var">mod</span></a></span></span><span>
</span><span id="line-205"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681106632"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106632"><span class="hs-identifier hs-var">trModuleDataCon</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#trModuleDataConName"><span class="hs-identifier hs-var">trModuleDataConName</span></a></span><span>
</span><span id="line-206"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106629"><span class="annot"><span class="annottext">FastString -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106629"><span class="hs-identifier hs-var">trNameLit</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM (FastString -&gt; LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkTrNameLit"><span class="hs-identifier hs-var">mkTrNameLit</span></a></span><span>
</span><span id="line-207"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsExpr (GhcPass 'Typechecked)))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106632"><span class="hs-identifier hs-var">trModuleDataCon</span></a></span><span>
</span><span id="line-208"></span><span>                  </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106629"><span class="hs-identifier hs-var">trNameLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenUnit UnitId -&gt; FastString
</span><a href="GHC.Unit.Types.html#unitFS"><span class="hs-identifier hs-var">unitFS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; GenUnit UnitId
forall unit. GenModule unit -&gt; unit
</span><a href="GHC.Unit.Types.html#moduleUnit"><span class="hs-identifier hs-var hs-var">moduleUnit</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106633"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-209"></span><span>                  </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106629"><span class="hs-identifier hs-var">trNameLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; FastString
</span><a href="GHC.Unit.Module.Name.html#moduleNameFS"><span class="hs-identifier hs-var">moduleNameFS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106633"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-210"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                Building type-representation bindings
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span class="hs-comment">-- | Information we need about a 'TyCon' to generate its representation. We</span><span>
</span><span id="line-219"></span><span class="hs-comment">-- carry the 'Id' in order to share it between the generation of the @TyCon@ and</span><span>
</span><span id="line-220"></span><span class="hs-comment">-- @KindRep@ bindings.</span><span>
</span><span id="line-221"></span><span class="hs-keyword">data</span><span> </span><span id="TypeableTyCon"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableTyCon"><span class="hs-identifier hs-var">TypeableTyCon</span></a></span></span><span>
</span><span id="line-222"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="TypeableTyCon"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableTyCon"><span class="hs-identifier hs-var">TypeableTyCon</span></a></span></span><span>
</span><span id="line-223"></span><span>      </span><span class="hs-special">{</span><span> </span><span id="tycon"><span class="annot"><span class="annottext">TypeableTyCon -&gt; TyCon
</span><a href="GHC.Tc.Instance.Typeable.html#tycon"><span class="hs-identifier hs-var hs-var">tycon</span></a></span></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>
</span><span id="line-224"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="tycon_rep_id"><span class="annot"><span class="annottext">TypeableTyCon -&gt; Var
</span><a href="GHC.Tc.Instance.Typeable.html#tycon_rep_id"><span class="hs-identifier hs-var hs-var">tycon_rep_id</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-225"></span><span>      </span><span class="hs-special">}</span><span>
</span><span id="line-226"></span><span>
</span><span id="line-227"></span><span class="hs-comment">-- | A group of 'TyCon's in need of type-rep bindings.</span><span>
</span><span id="line-228"></span><span class="hs-keyword">data</span><span> </span><span id="TypeRepTodo"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-var">TypeRepTodo</span></a></span></span><span>
</span><span id="line-229"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="TypeRepTodo"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-var">TypeRepTodo</span></a></span></span><span>
</span><span id="line-230"></span><span>      </span><span class="hs-special">{</span><span> </span><span id="mod_rep_expr"><span class="annot"><span class="annottext">TypeRepTodo -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#mod_rep_expr"><span class="hs-identifier hs-var hs-var">mod_rep_expr</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>    </span><span class="hs-comment">-- ^ Module's typerep binding</span><span>
</span><span id="line-231"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="pkg_fingerprint"><span class="annot"><span class="annottext">TypeRepTodo -&gt; Fingerprint
</span><a href="GHC.Tc.Instance.Typeable.html#pkg_fingerprint"><span class="hs-identifier hs-var hs-var">pkg_fingerprint</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../base/src/GHC.Fingerprint.Type.html#Fingerprint"><span class="hs-identifier hs-type">Fingerprint</span></a></span><span>     </span><span class="hs-comment">-- ^ Package name fingerprint</span><span>
</span><span id="line-232"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="mod_fingerprint"><span class="annot"><span class="annottext">TypeRepTodo -&gt; Fingerprint
</span><a href="GHC.Tc.Instance.Typeable.html#mod_fingerprint"><span class="hs-identifier hs-var hs-var">mod_fingerprint</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="../../base/src/GHC.Fingerprint.Type.html#Fingerprint"><span class="hs-identifier hs-type">Fingerprint</span></a></span><span>     </span><span class="hs-comment">-- ^ Module name fingerprint</span><span>
</span><span id="line-233"></span><span>      </span><span class="hs-special">,</span><span> </span><span id="todo_tycons"><span class="annot"><span class="annottext">TypeRepTodo -&gt; [TypeableTyCon]
</span><a href="GHC.Tc.Instance.Typeable.html#todo_tycons"><span class="hs-identifier hs-var hs-var">todo_tycons</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableTyCon"><span class="hs-identifier hs-type">TypeableTyCon</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-234"></span><span>        </span><span class="hs-comment">-- ^ The 'TyCon's in need of bindings kinds</span><span>
</span><span id="line-235"></span><span>      </span><span class="hs-special">}</span><span>
</span><span id="line-236"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span id="ExportedKindRepsTodo"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#ExportedKindRepsTodo"><span class="hs-identifier hs-var">ExportedKindRepsTodo</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-237"></span><span>      </span><span class="hs-comment">-- ^ Build exported 'KindRep' bindings for the given set of kinds.</span><span>
</span><span id="line-238"></span><span>
</span><span id="line-239"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#todoForTyCons"><span class="hs-identifier hs-type">todoForTyCons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span>
</span><span id="line-240"></span><span id="todoForTyCons"><span class="annot"><span class="annottext">todoForTyCons :: Module -&gt; Var -&gt; [TyCon] -&gt; TcM TypeRepTodo
</span><a href="GHC.Tc.Instance.Typeable.html#todoForTyCons"><span class="hs-identifier hs-var hs-var">todoForTyCons</span></a></span></span><span> </span><span id="local-6989586621681106611"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106611"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span id="local-6989586621681106610"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106610"><span class="hs-identifier hs-var">mod_id</span></a></span></span><span> </span><span id="local-6989586621681106609"><span class="annot"><span class="annottext">[TyCon]
</span><a href="#local-6989586621681106609"><span class="hs-identifier hs-var">tycons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-241"></span><span>    </span><span id="local-6989586621681106608"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106608"><span class="hs-identifier hs-var">trTyConTy</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Kind
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Kind) -&gt; TcM TyCon -&gt; IOEnv (Env TcGblEnv TcLclEnv) Kind
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#trTyConTyConName"><span class="hs-identifier hs-var">trTyConTyConName</span></a></span><span>
</span><span id="line-242"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681106605"><span class="hs-identifier hs-type">mk_rep_id</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyConRepName"><span class="hs-identifier hs-type">TyConRepName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-243"></span><span>        </span><span id="local-6989586621681106605"><span class="annot"><span class="annottext">mk_rep_id :: Name -&gt; Var
</span><a href="#local-6989586621681106605"><span class="hs-identifier hs-var hs-var">mk_rep_id</span></a></span></span><span> </span><span id="local-6989586621681106603"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106603"><span class="hs-identifier hs-var">rep_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Kind -&gt; Var
</span><a href="GHC.Types.Id.html#mkExportedVanillaId"><span class="hs-identifier hs-var">mkExportedVanillaId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106603"><span class="hs-identifier hs-var">rep_name</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106608"><span class="hs-identifier hs-var">trTyConTy</span></a></span><span>
</span><span id="line-244"></span><span>
</span><span id="line-245"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681106602"><span class="hs-identifier hs-type">typeable_tycons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableTyCon"><span class="hs-identifier hs-type">TypeableTyCon</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-246"></span><span>        </span><span id="local-6989586621681106602"><span class="annot"><span class="annottext">typeable_tycons :: [TypeableTyCon]
</span><a href="#local-6989586621681106602"><span class="hs-identifier hs-var hs-var">typeable_tycons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-247"></span><span>            </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TypeableTyCon :: TyCon -&gt; Var -&gt; TypeableTyCon
</span><a href="GHC.Tc.Instance.Typeable.html#TypeableTyCon"><span class="hs-identifier hs-type">TypeableTyCon</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tycon :: TyCon
</span><a href="GHC.Tc.Instance.Typeable.html#tycon"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106601"><span class="hs-identifier hs-var">tc''</span></a></span><span>
</span><span id="line-248"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">tycon_rep_id :: Var
</span><a href="GHC.Tc.Instance.Typeable.html#tycon_rep_id"><span class="hs-identifier hs-var">tycon_rep_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Var
</span><a href="#local-6989586621681106605"><span class="hs-identifier hs-var">mk_rep_id</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106600"><span class="hs-identifier hs-var">rep_name</span></a></span><span>
</span><span id="line-249"></span><span>                            </span><span class="hs-special">}</span><span>
</span><span id="line-250"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681106599"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106599"><span class="hs-identifier hs-var">tc</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TyCon]
</span><a href="#local-6989586621681106609"><span class="hs-identifier hs-var">tycons</span></a></span><span>
</span><span id="line-251"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106598"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106598"><span class="hs-identifier hs-var">tc'</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106599"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyCon] -&gt; [TyCon]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyCon]
</span><a href="GHC.Core.TyCon.html#tyConATs"><span class="hs-identifier hs-var">tyConATs</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106599"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-252"></span><span>              </span><span class="hs-comment">-- We need type representations for any associated types</span><span>
</span><span id="line-253"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106596"><span class="annot"><span class="annottext">promoted :: [TyCon]
</span><a href="#local-6989586621681106596"><span class="hs-identifier hs-var hs-var">promoted</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DataCon -&gt; TyCon) -&gt; [DataCon] -&gt; [TyCon]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; TyCon
</span><a href="GHC.Core.DataCon.html#promoteDataCon"><span class="hs-identifier hs-var">promoteDataCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [DataCon]
</span><a href="GHC.Core.TyCon.html#tyConDataCons"><span class="hs-identifier hs-var">tyConDataCons</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106598"><span class="hs-identifier hs-var">tc'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-254"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106601"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106601"><span class="hs-identifier hs-var">tc''</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106598"><span class="hs-identifier hs-var">tc'</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyCon] -&gt; [TyCon]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[TyCon]
</span><a href="#local-6989586621681106596"><span class="hs-identifier hs-var">promoted</span></a></span><span>
</span><span id="line-255"></span><span>              </span><span class="hs-comment">-- Don't make bindings for data-family instance tycons.</span><span>
</span><span id="line-256"></span><span>              </span><span class="hs-comment">-- Do, however, make them for their promoted datacon (see #13915).</span><span>
</span><span id="line-257"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isFamInstTyCon"><span class="hs-identifier hs-var">isFamInstTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106601"><span class="hs-identifier hs-var">tc''</span></a></span><span>
</span><span id="line-258"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681106600"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106600"><span class="hs-identifier hs-var">rep_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe Name -&gt; [Maybe Name]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe Name -&gt; [Maybe Name]) -&gt; Maybe Name -&gt; [Maybe Name]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe Name
</span><a href="GHC.Core.TyCon.html#tyConRepName_maybe"><span class="hs-identifier hs-var">tyConRepName_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106601"><span class="hs-identifier hs-var">tc''</span></a></span><span>
</span><span id="line-259"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#tyConIsTypeable"><span class="hs-identifier hs-var">tyConIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106601"><span class="hs-identifier hs-var">tc''</span></a></span><span>
</span><span id="line-260"></span><span>            </span><span class="hs-special">]</span><span>
</span><span id="line-261"></span><span>    </span><span class="annot"><span class="annottext">TypeRepTodo -&gt; TcM TypeRepTodo
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo :: LHsExpr (GhcPass 'Typechecked)
-&gt; Fingerprint -&gt; Fingerprint -&gt; [TypeableTyCon] -&gt; TypeRepTodo
</span><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mod_rep_expr :: LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#mod_rep_expr"><span class="hs-identifier hs-var">mod_rep_expr</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106610"><span class="hs-identifier hs-var">mod_id</span></a></span><span>
</span><span id="line-262"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pkg_fingerprint :: Fingerprint
</span><a href="GHC.Tc.Instance.Typeable.html#pkg_fingerprint"><span class="hs-identifier hs-var">pkg_fingerprint</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Fingerprint
</span><a href="#local-6989586621681106589"><span class="hs-identifier hs-var">pkg_fpr</span></a></span><span>
</span><span id="line-263"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mod_fingerprint :: Fingerprint
</span><a href="GHC.Tc.Instance.Typeable.html#mod_fingerprint"><span class="hs-identifier hs-var">mod_fingerprint</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Fingerprint
</span><a href="#local-6989586621681106588"><span class="hs-identifier hs-var">mod_fpr</span></a></span><span>
</span><span id="line-264"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">todo_tycons :: [TypeableTyCon]
</span><a href="GHC.Tc.Instance.Typeable.html#todo_tycons"><span class="hs-identifier hs-var">todo_tycons</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TypeableTyCon]
</span><a href="#local-6989586621681106602"><span class="hs-identifier hs-var">typeable_tycons</span></a></span><span>
</span><span id="line-265"></span><span>                       </span><span class="hs-special">}</span><span>
</span><span id="line-266"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-267"></span><span>    </span><span id="local-6989586621681106588"><span class="annot"><span class="annottext">mod_fpr :: Fingerprint
</span><a href="#local-6989586621681106588"><span class="hs-identifier hs-var hs-var">mod_fpr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Fingerprint
</span><a href="../../base/src/GHC.Fingerprint.html#fingerprintString"><span class="hs-identifier hs-var">fingerprintString</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Fingerprint) -&gt; String -&gt; Fingerprint
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; String
</span><a href="GHC.Unit.Module.Name.html#moduleNameString"><span class="hs-identifier hs-var">moduleNameString</span></a></span><span> </span><span class="annot"><span class="annottext">(ModuleName -&gt; String) -&gt; ModuleName -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106611"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-268"></span><span>    </span><span id="local-6989586621681106589"><span class="annot"><span class="annottext">pkg_fpr :: Fingerprint
</span><a href="#local-6989586621681106589"><span class="hs-identifier hs-var hs-var">pkg_fpr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Fingerprint
</span><a href="../../base/src/GHC.Fingerprint.html#fingerprintString"><span class="hs-identifier hs-var">fingerprintString</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Fingerprint) -&gt; String -&gt; Fingerprint
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">GenUnit UnitId -&gt; String
</span><a href="GHC.Unit.Types.html#unitString"><span class="hs-identifier hs-var">unitString</span></a></span><span> </span><span class="annot"><span class="annottext">(GenUnit UnitId -&gt; String) -&gt; GenUnit UnitId -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; GenUnit UnitId
forall unit. GenModule unit -&gt; unit
</span><a href="GHC.Unit.Types.html#moduleUnit"><span class="hs-identifier hs-var hs-var">moduleUnit</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106611"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-269"></span><span>
</span><span id="line-270"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#todoForExportedKindReps"><span class="hs-identifier hs-type">todoForExportedKindReps</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span>
</span><span id="line-271"></span><span id="todoForExportedKindReps"><span class="annot"><span class="annottext">todoForExportedKindReps :: [(Kind, Name)] -&gt; TcM TypeRepTodo
</span><a href="GHC.Tc.Instance.Typeable.html#todoForExportedKindReps"><span class="hs-identifier hs-var hs-var">todoForExportedKindReps</span></a></span></span><span> </span><span id="local-6989586621681106584"><span class="annot"><span class="annottext">[(Kind, Name)]
</span><a href="#local-6989586621681106584"><span class="hs-identifier hs-var">kinds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-272"></span><span>    </span><span id="local-6989586621681106583"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106583"><span class="hs-identifier hs-var">trKindRepTy</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Kind
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Kind) -&gt; TcM TyCon -&gt; IOEnv (Env TcGblEnv TcLclEnv) Kind
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#kindRepTyConName"><span class="hs-identifier hs-var">kindRepTyConName</span></a></span><span>
</span><span id="line-273"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106581"><span class="annot"><span class="annottext">mkId :: (Kind, Name) -&gt; (Kind, Var)
</span><a href="#local-6989586621681106581"><span class="hs-identifier hs-var hs-var">mkId</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106580"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106580"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106579"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106579"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106580"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Kind -&gt; Var
</span><a href="GHC.Types.Id.html#mkExportedVanillaId"><span class="hs-identifier hs-var">mkExportedVanillaId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106579"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106583"><span class="hs-identifier hs-var">trKindRepTy</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-274"></span><span>    </span><span class="annot"><span class="annottext">TypeRepTodo -&gt; TcM TypeRepTodo
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(TypeRepTodo -&gt; TcM TypeRepTodo) -&gt; TypeRepTodo -&gt; TcM TypeRepTodo
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[(Kind, Var)] -&gt; TypeRepTodo
</span><a href="GHC.Tc.Instance.Typeable.html#ExportedKindRepsTodo"><span class="hs-identifier hs-var">ExportedKindRepsTodo</span></a></span><span> </span><span class="annot"><span class="annottext">([(Kind, Var)] -&gt; TypeRepTodo) -&gt; [(Kind, Var)] -&gt; TypeRepTodo
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((Kind, Name) -&gt; (Kind, Var)) -&gt; [(Kind, Name)] -&gt; [(Kind, Var)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Kind, Name) -&gt; (Kind, Var)
</span><a href="#local-6989586621681106581"><span class="hs-identifier hs-var">mkId</span></a></span><span> </span><span class="annot"><span class="annottext">[(Kind, Name)]
</span><a href="#local-6989586621681106584"><span class="hs-identifier hs-var">kinds</span></a></span><span>
</span><span id="line-275"></span><span>
</span><span id="line-276"></span><span class="hs-comment">-- | Generate TyCon bindings for a set of type constructors</span><span>
</span><span id="line-277"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkTypeRepTodoBinds"><span class="hs-identifier hs-type">mkTypeRepTodoBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span>
</span><span id="line-278"></span><span id="mkTypeRepTodoBinds"><span class="annot"><span class="annottext">mkTypeRepTodoBinds :: [TypeRepTodo] -&gt; TcM TcGblEnv
</span><a href="GHC.Tc.Instance.Typeable.html#mkTypeRepTodoBinds"><span class="hs-identifier hs-var hs-var">mkTypeRepTodoBinds</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcM TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-279"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkTypeRepTodoBinds"><span class="hs-identifier hs-var">mkTypeRepTodoBinds</span></a></span><span> </span><span id="local-6989586621681106578"><span class="annot"><span class="annottext">[TypeRepTodo]
</span><a href="#local-6989586621681106578"><span class="hs-identifier hs-var">todos</span></a></span></span><span>
</span><span id="line-280"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681106577"><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106577"><span class="hs-identifier hs-var">stuff</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM TypeableStuff
</span><a href="GHC.Tc.Instance.Typeable.html#collect_stuff"><span class="hs-identifier hs-var">collect_stuff</span></a></span><span>
</span><span id="line-281"></span><span>
</span><span id="line-282"></span><span>         </span><span class="hs-comment">-- First extend the type environment with all of the bindings</span><span>
</span><span id="line-283"></span><span>         </span><span class="hs-comment">-- which we are going to produce since we may need to refer to them</span><span>
</span><span id="line-284"></span><span>         </span><span class="hs-comment">-- while generating kind representations (namely, when we want to</span><span>
</span><span id="line-285"></span><span>         </span><span class="hs-comment">-- represent a TyConApp in a kind, we must be able to look up the</span><span>
</span><span id="line-286"></span><span>         </span><span class="hs-comment">-- TyCon associated with the applied type constructor).</span><span>
</span><span id="line-287"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681106575"><span class="hs-identifier hs-type">produced_bndrs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-288"></span><span>             </span><span id="local-6989586621681106575"><span class="annot"><span class="annottext">produced_bndrs :: [Var]
</span><a href="#local-6989586621681106575"><span class="hs-identifier hs-var hs-var">produced_bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106574"><span class="hs-identifier hs-var">tycon_rep_id</span></a></span><span>
</span><span id="line-289"></span><span>                              </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681106573"><span class="annot"><span class="annottext">todo :: TypeRepTodo
</span><a href="#local-6989586621681106573"><span class="hs-identifier hs-var">todo</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TypeRepTodo]
</span><a href="#local-6989586621681106578"><span class="hs-identifier hs-var">todos</span></a></span><span>
</span><span id="line-290"></span><span>                              </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableTyCon"><span class="hs-identifier hs-type">TypeableTyCon</span></a></span><span> </span><span class="hs-special">{</span><span id="local-6989586621681106572"><span id="local-6989586621681106574"><span class="annot"><span class="annottext">Var
TyCon
tycon :: TyCon
tycon_rep_id :: Var
tycon_rep_id :: TypeableTyCon -&gt; Var
tycon :: TypeableTyCon -&gt; TyCon
</span><a href="#local-6989586621681106572"><span class="hs-glyph hs-var hs-var hs-var hs-var">..</span></a></span></span></span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TypeRepTodo -&gt; [TypeableTyCon]
</span><a href="GHC.Tc.Instance.Typeable.html#todo_tycons"><span class="hs-identifier hs-var hs-var">todo_tycons</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106573"><span class="hs-identifier hs-var">todo</span></a></span><span>
</span><span id="line-291"></span><span>                              </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; [Var] -&gt; [Var]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-292"></span><span>                              </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106571"><span class="hs-identifier hs-var">rep_id</span></a></span><span>
</span><span id="line-293"></span><span>                              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#ExportedKindRepsTodo"><span class="hs-identifier hs-type">ExportedKindRepsTodo</span></a></span><span> </span><span id="local-6989586621681106570"><span class="annot"><span class="annottext">[(Kind, Var)]
</span><a href="#local-6989586621681106570"><span class="hs-identifier hs-var">kinds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TypeRepTodo]
</span><a href="#local-6989586621681106578"><span class="hs-identifier hs-var">todos</span></a></span><span>
</span><span id="line-294"></span><span>                              </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106571"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106571"><span class="hs-identifier hs-var">rep_id</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Kind, Var)]
</span><a href="#local-6989586621681106570"><span class="hs-identifier hs-var">kinds</span></a></span><span>
</span><span id="line-295"></span><span>                              </span><span class="hs-special">]</span><span>
</span><span id="line-296"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106569"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106569"><span class="hs-identifier hs-var">gbl_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; TcM TcGblEnv -&gt; TcM TcGblEnv
forall a. [Var] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendGlobalValEnv"><span class="hs-identifier hs-var">tcExtendGlobalValEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621681106575"><span class="hs-identifier hs-var">produced_bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">TcM TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-297"></span><span>
</span><span id="line-298"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681106568"><span class="hs-identifier hs-type">mk_binds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-299"></span><span>             </span><span id="local-6989586621681106568"><span class="annot"><span class="annottext">mk_binds :: TypeRepTodo -&gt; KindRepM [LHsBinds (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681106568"><span class="hs-identifier hs-var hs-var">mk_binds</span></a></span></span><span> </span><span id="local-6989586621681106567"><span class="annot"><span class="annottext">todo :: TypeRepTodo
</span><a href="#local-6989586621681106567"><span class="hs-identifier hs-var">todo</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-300"></span><span>                 </span><span class="annot"><span class="annottext">(TypeableTyCon -&gt; KindRepM (LHsBinds (GhcPass 'Typechecked)))
-&gt; [TypeableTyCon] -&gt; KindRepM [LHsBinds (GhcPass 'Typechecked)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TypeableStuff
-&gt; TypeRepTodo
-&gt; TypeableTyCon
-&gt; KindRepM (LHsBinds (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkTyConRepBinds"><span class="hs-identifier hs-var">mkTyConRepBinds</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106577"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106567"><span class="hs-identifier hs-var">todo</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TypeRepTodo -&gt; [TypeableTyCon]
</span><a href="GHC.Tc.Instance.Typeable.html#todo_tycons"><span class="hs-identifier hs-var hs-var">todo_tycons</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106567"><span class="hs-identifier hs-var">todo</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-301"></span><span>             </span><span class="annot"><a href="#local-6989586621681106568"><span class="hs-identifier hs-var">mk_binds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#ExportedKindRepsTodo"><span class="hs-identifier hs-type">ExportedKindRepsTodo</span></a></span><span> </span><span id="local-6989586621681106564"><span class="annot"><span class="annottext">[(Kind, Var)]
</span><a href="#local-6989586621681106564"><span class="hs-identifier hs-var">kinds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-302"></span><span>                 </span><span class="annot"><span class="annottext">TypeableStuff -&gt; [(Kind, Var)] -&gt; KindRepM ()
</span><a href="GHC.Tc.Instance.Typeable.html#mkExportedKindReps"><span class="hs-identifier hs-var">mkExportedKindReps</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106577"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">[(Kind, Var)]
</span><a href="#local-6989586621681106564"><span class="hs-identifier hs-var">kinds</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepM ()
-&gt; KindRepM [LHsBinds (GhcPass 'Typechecked)]
-&gt; KindRepM [LHsBinds (GhcPass 'Typechecked)]
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBinds (GhcPass 'Typechecked)]
-&gt; KindRepM [LHsBinds (GhcPass 'Typechecked)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-303"></span><span>
</span><span id="line-304"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106562"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106562"><span class="hs-identifier hs-var">gbl_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106561"><span class="annot"><span class="annottext">[[LHsBinds (GhcPass 'Typechecked)]]
</span><a href="#local-6989586621681106561"><span class="hs-identifier hs-var">binds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
-&gt; TcRnIf
     TcGblEnv TcLclEnv (TcGblEnv, [[LHsBinds (GhcPass 'Typechecked)]])
-&gt; TcRnIf
     TcGblEnv TcLclEnv (TcGblEnv, [[LHsBinds (GhcPass 'Typechecked)]])
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106569"><span class="hs-identifier hs-var">gbl_env</span></a></span><span>
</span><span id="line-305"></span><span>                             </span><span class="annot"><span class="annottext">(TcRnIf
   TcGblEnv TcLclEnv (TcGblEnv, [[LHsBinds (GhcPass 'Typechecked)]])
 -&gt; TcRnIf
      TcGblEnv TcLclEnv (TcGblEnv, [[LHsBinds (GhcPass 'Typechecked)]]))
-&gt; TcRnIf
     TcGblEnv TcLclEnv (TcGblEnv, [[LHsBinds (GhcPass 'Typechecked)]])
-&gt; TcRnIf
     TcGblEnv TcLclEnv (TcGblEnv, [[LHsBinds (GhcPass 'Typechecked)]])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepM [[LHsBinds (GhcPass 'Typechecked)]]
-&gt; TcRnIf
     TcGblEnv TcLclEnv (TcGblEnv, [[LHsBinds (GhcPass 'Typechecked)]])
forall a. KindRepM a -&gt; TcRn (TcGblEnv, a)
</span><a href="GHC.Tc.Instance.Typeable.html#runKindRepM"><span class="hs-identifier hs-var">runKindRepM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TypeRepTodo -&gt; KindRepM [LHsBinds (GhcPass 'Typechecked)])
-&gt; [TypeRepTodo] -&gt; KindRepM [[LHsBinds (GhcPass 'Typechecked)]]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo -&gt; KindRepM [LHsBinds (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681106568"><span class="hs-identifier hs-var">mk_binds</span></a></span><span> </span><span class="annot"><span class="annottext">[TypeRepTodo]
</span><a href="#local-6989586621681106578"><span class="hs-identifier hs-var">todos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-306"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcM TcGblEnv
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(TcGblEnv -&gt; TcM TcGblEnv) -&gt; TcGblEnv -&gt; TcM TcGblEnv
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106562"><span class="hs-identifier hs-var">gbl_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [LHsBinds (GhcPass 'Typechecked)] -&gt; TcGblEnv
</span><a href="GHC.Tc.Utils.Env.html#addTypecheckedBinds"><span class="hs-operator hs-var">`addTypecheckedBinds`</span></a></span><span> </span><span class="annot"><span class="annottext">[[LHsBinds (GhcPass 'Typechecked)]]
-&gt; [LHsBinds (GhcPass 'Typechecked)]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[LHsBinds (GhcPass 'Typechecked)]]
</span><a href="#local-6989586621681106561"><span class="hs-identifier hs-var">binds</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span class="hs-comment">-- | Generate bindings for the type representation of a wired-in 'TyCon's</span><span>
</span><span id="line-309"></span><span class="hs-comment">-- defined by the virtual &quot;GHC.Prim&quot; module. This is where we inject the</span><span>
</span><span id="line-310"></span><span class="hs-comment">-- representation bindings for these primitive types into &quot;GHC.Types&quot;</span><span>
</span><span id="line-311"></span><span class="hs-comment">--</span><span>
</span><span id="line-312"></span><span class="hs-comment">-- See Note [Grand plan for Typeable] in this module.</span><span>
</span><span id="line-313"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkPrimTypeableTodos"><span class="hs-identifier hs-type">mkPrimTypeableTodos</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-314"></span><span id="mkPrimTypeableTodos"><span class="annot"><span class="annottext">mkPrimTypeableTodos :: TcRnIf TcGblEnv TcLclEnv (TcGblEnv, [TypeRepTodo])
</span><a href="GHC.Tc.Instance.Typeable.html#mkPrimTypeableTodos"><span class="hs-identifier hs-var hs-var">mkPrimTypeableTodos</span></a></span></span><span>
</span><span id="line-315"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681106558"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106558"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) Module
forall (m :: * -&gt; *). HasModule m =&gt; m Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var">getModule</span></a></span><span>
</span><span id="line-316"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681106558"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; Module -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="GHC.Builtin.Names.html#gHC_TYPES"><span class="hs-identifier hs-var">gHC_TYPES</span></a></span><span>
</span><span id="line-317"></span><span>           </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- Build Module binding for GHC.Prim</span><span>
</span><span id="line-318"></span><span>                     </span><span id="local-6989586621681106556"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106556"><span class="hs-identifier hs-var">trModuleTyCon</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#trModuleTyConName"><span class="hs-identifier hs-var">trModuleTyConName</span></a></span><span>
</span><span id="line-319"></span><span>                   </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106555"><span class="annot"><span class="annottext">ghc_prim_module_id :: Var
</span><a href="#local-6989586621681106555"><span class="hs-identifier hs-var hs-var">ghc_prim_module_id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-320"></span><span>                             </span><span class="annot"><span class="annottext">Name -&gt; Kind -&gt; Var
</span><a href="GHC.Types.Id.html#mkExportedVanillaId"><span class="hs-identifier hs-var">mkExportedVanillaId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#trGhcPrimModuleName"><span class="hs-identifier hs-var">trGhcPrimModuleName</span></a></span><span>
</span><span id="line-321"></span><span>                                                 </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Kind
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106556"><span class="hs-identifier hs-var">trModuleTyCon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span>
</span><span id="line-323"></span><span>                   </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106553"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106553"><span class="hs-identifier hs-var">ghc_prim_module_bind</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsBind (GhcPass 'Typechecked)
forall (p :: Pass).
IdP (GhcPass p) -&gt; LHsExpr (GhcPass p) -&gt; LHsBind (GhcPass p)
</span><a href="GHC.Hs.Utils.html#mkVarBind"><span class="hs-identifier hs-var">mkVarBind</span></a></span><span> </span><span class="annot"><span class="annottext">Var
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106555"><span class="hs-identifier hs-var">ghc_prim_module_id</span></a></span><span>
</span><span id="line-324"></span><span>                                             </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked) -&gt; LHsBind (GhcPass 'Typechecked))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsBind (GhcPass 'Typechecked))
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Module
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkModIdRHS"><span class="hs-identifier hs-var">mkModIdRHS</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="GHC.Builtin.Names.html#gHC_PRIM"><span class="hs-identifier hs-var">gHC_PRIM</span></a></span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span>                     </span><span class="hs-comment">-- Extend our environment with above</span><span>
</span><span id="line-327"></span><span>                   </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106551"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106551"><span class="hs-identifier hs-var">gbl_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; TcM TcGblEnv -&gt; TcM TcGblEnv
forall a. [Var] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendGlobalValEnv"><span class="hs-identifier hs-var">tcExtendGlobalValEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106555"><span class="hs-identifier hs-var">ghc_prim_module_id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-328"></span><span>                                                     </span><span class="annot"><span class="annottext">TcM TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-329"></span><span>                   </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106550"><span class="annot"><span class="annottext">gbl_env' :: TcGblEnv
</span><a href="#local-6989586621681106550"><span class="hs-identifier hs-var hs-var">gbl_env'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106551"><span class="hs-identifier hs-var">gbl_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [LHsBinds (GhcPass 'Typechecked)] -&gt; TcGblEnv
</span><a href="GHC.Tc.Utils.Env.html#addTypecheckedBinds"><span class="hs-operator hs-var">`addTypecheckedBinds`</span></a></span><span>
</span><span id="line-330"></span><span>                                    </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Typechecked) -&gt; LHsBinds (GhcPass 'Typechecked)
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106553"><span class="hs-identifier hs-var">ghc_prim_module_bind</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-331"></span><span>
</span><span id="line-332"></span><span>                     </span><span class="hs-comment">-- Build TypeRepTodos for built-in KindReps</span><span>
</span><span id="line-333"></span><span>                   </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106549"><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106549"><span class="hs-identifier hs-var">todo1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Kind, Name)] -&gt; TcM TypeRepTodo
</span><a href="GHC.Tc.Instance.Typeable.html#todoForExportedKindReps"><span class="hs-identifier hs-var">todoForExportedKindReps</span></a></span><span> </span><span class="annot"><span class="annottext">[(Kind, Name)]
</span><a href="GHC.Tc.Instance.Typeable.html#builtInKindReps"><span class="hs-identifier hs-var">builtInKindReps</span></a></span><span>
</span><span id="line-334"></span><span>                     </span><span class="hs-comment">-- Build TypeRepTodos for types in GHC.Prim</span><span>
</span><span id="line-335"></span><span>                   </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681106547"><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106547"><span class="hs-identifier hs-var">todo2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Module -&gt; Var -&gt; [TyCon] -&gt; TcM TypeRepTodo
</span><a href="GHC.Tc.Instance.Typeable.html#todoForTyCons"><span class="hs-identifier hs-var">todoForTyCons</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="GHC.Builtin.Names.html#gHC_PRIM"><span class="hs-identifier hs-var">gHC_PRIM</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106555"><span class="hs-identifier hs-var">ghc_prim_module_id</span></a></span><span>
</span><span id="line-336"></span><span>                                            </span><span class="annot"><span class="annottext">[TyCon]
</span><a href="GHC.Tc.Instance.Typeable.html#ghcPrimTypeableTyCons"><span class="hs-identifier hs-var">ghcPrimTypeableTyCons</span></a></span><span>
</span><span id="line-337"></span><span>                   </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcGblEnv, [TypeRepTodo])
-&gt; TcRnIf TcGblEnv TcLclEnv (TcGblEnv, [TypeRepTodo])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106550"><span class="hs-identifier hs-var">gbl_env'</span></a></span><span> </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106549"><span class="hs-identifier hs-var">todo1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106547"><span class="hs-identifier hs-var">todo2</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-338"></span><span>                   </span><span class="hs-special">}</span><span>
</span><span id="line-339"></span><span>           </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681106545"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106545"><span class="hs-identifier hs-var">gbl_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-340"></span><span>                   </span><span class="annot"><span class="annottext">(TcGblEnv, [TypeRepTodo])
-&gt; TcRnIf TcGblEnv TcLclEnv (TcGblEnv, [TypeRepTodo])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106545"><span class="hs-identifier hs-var">gbl_env</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-341"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-342"></span><span>
</span><span id="line-343"></span><span class="hs-comment">-- | This is the list of primitive 'TyCon's for which we must generate bindings</span><span>
</span><span id="line-344"></span><span class="hs-comment">-- in &quot;GHC.Types&quot;. This should include all types defined in &quot;GHC.Prim&quot;.</span><span>
</span><span id="line-345"></span><span class="hs-comment">--</span><span>
</span><span id="line-346"></span><span class="hs-comment">-- The majority of the types we need here are contained in 'primTyCons'.</span><span>
</span><span id="line-347"></span><span class="hs-comment">-- However, not all of them: in particular unboxed tuples are absent since we</span><span>
</span><span id="line-348"></span><span class="hs-comment">-- don't want to include them in the original name cache. See</span><span>
</span><span id="line-349"></span><span class="hs-comment">-- Note [Built-in syntax and the OrigNameCache] in &quot;GHC.Iface.Env&quot; for more.</span><span>
</span><span id="line-350"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#ghcPrimTypeableTyCons"><span class="hs-identifier hs-type">ghcPrimTypeableTyCons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-351"></span><span id="ghcPrimTypeableTyCons"><span class="annot"><span class="annottext">ghcPrimTypeableTyCons :: [TyCon]
</span><a href="GHC.Tc.Instance.Typeable.html#ghcPrimTypeableTyCons"><span class="hs-identifier hs-var hs-var">ghcPrimTypeableTyCons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[TyCon]] -&gt; [TyCon]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span>
</span><span id="line-352"></span><span>    </span><span class="hs-special">[</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#runtimeRepTyCon"><span class="hs-identifier hs-var">runtimeRepTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#vecCountTyCon"><span class="hs-identifier hs-var">vecCountTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#vecElemTyCon"><span class="hs-identifier hs-var">vecElemTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.Prim.html#funTyCon"><span class="hs-identifier hs-var">funTyCon</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-353"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; TyCon) -&gt; [Int] -&gt; [TyCon]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Boxity -&gt; Int -&gt; TyCon
</span><a href="GHC.Builtin.Types.html#tupleTyCon"><span class="hs-identifier hs-var">tupleTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="GHC.Types.Basic.html#Unboxed"><span class="hs-identifier hs-var">Unboxed</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-glyph">..</span><span class="annot"><span class="annottext">Int
</span><a href="GHC.Settings.Constants.html#mAX_TUPLE_SIZE"><span class="hs-identifier hs-var">mAX_TUPLE_SIZE</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-354"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; TyCon) -&gt; [Int] -&gt; [TyCon]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; TyCon
</span><a href="GHC.Builtin.Types.html#sumTyCon"><span class="hs-identifier hs-var">sumTyCon</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-glyph">..</span><span class="annot"><span class="annottext">Int
</span><a href="GHC.Settings.Constants.html#mAX_SUM_SIZE"><span class="hs-identifier hs-var">mAX_SUM_SIZE</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-355"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TyCon]
</span><a href="GHC.Builtin.Types.Prim.html#primTyCons"><span class="hs-identifier hs-var">primTyCons</span></a></span><span>
</span><span id="line-356"></span><span>    </span><span class="hs-special">]</span><span>
</span><span id="line-357"></span><span>
</span><span id="line-358"></span><span class="hs-keyword">data</span><span> </span><span id="TypeableStuff"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableStuff"><span class="hs-identifier hs-var">TypeableStuff</span></a></span></span><span>
</span><span id="line-359"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="Stuff"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#Stuff"><span class="hs-identifier hs-var">Stuff</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="platform"><span class="annot"><span class="annottext">TypeableStuff -&gt; Platform
</span><a href="GHC.Tc.Instance.Typeable.html#platform"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span>        </span><span class="hs-comment">-- ^ Target platform</span><span>
</span><span id="line-360"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="trTyConDataCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; DataCon
</span><a href="GHC.Tc.Instance.Typeable.html#trTyConDataCon"><span class="hs-identifier hs-var hs-var">trTyConDataCon</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>         </span><span class="hs-comment">-- ^ of @TyCon@</span><span>
</span><span id="line-361"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="trNameLit"><span class="annot"><span class="annottext">TypeableStuff -&gt; FastString -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#trNameLit"><span class="hs-identifier hs-var hs-var">trNameLit</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-362"></span><span>                                                </span><span class="hs-comment">-- ^ To construct @TrName@s</span><span>
</span><span id="line-363"></span><span>              </span><span class="hs-comment">-- The various TyCon and DataCons of KindRep</span><span>
</span><span id="line-364"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="kindRepTyCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; TyCon
</span><a href="GHC.Tc.Instance.Typeable.html#kindRepTyCon"><span class="hs-identifier hs-var hs-var">kindRepTyCon</span></a></span></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>
</span><span id="line-365"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="kindRepTyConAppDataCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; DataCon
</span><a href="GHC.Tc.Instance.Typeable.html#kindRepTyConAppDataCon"><span class="hs-identifier hs-var hs-var">kindRepTyConAppDataCon</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-366"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="kindRepVarDataCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; DataCon
</span><a href="GHC.Tc.Instance.Typeable.html#kindRepVarDataCon"><span class="hs-identifier hs-var hs-var">kindRepVarDataCon</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-367"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="kindRepAppDataCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; DataCon
</span><a href="GHC.Tc.Instance.Typeable.html#kindRepAppDataCon"><span class="hs-identifier hs-var hs-var">kindRepAppDataCon</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-368"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="kindRepFunDataCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; DataCon
</span><a href="GHC.Tc.Instance.Typeable.html#kindRepFunDataCon"><span class="hs-identifier hs-var hs-var">kindRepFunDataCon</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-369"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="kindRepTYPEDataCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; DataCon
</span><a href="GHC.Tc.Instance.Typeable.html#kindRepTYPEDataCon"><span class="hs-identifier hs-var hs-var">kindRepTYPEDataCon</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-370"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="kindRepTypeLitSDataCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; DataCon
</span><a href="GHC.Tc.Instance.Typeable.html#kindRepTypeLitSDataCon"><span class="hs-identifier hs-var hs-var">kindRepTypeLitSDataCon</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-371"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="typeLitSymbolDataCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; DataCon
</span><a href="GHC.Tc.Instance.Typeable.html#typeLitSymbolDataCon"><span class="hs-identifier hs-var hs-var">typeLitSymbolDataCon</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-372"></span><span>            </span><span class="hs-special">,</span><span> </span><span id="typeLitNatDataCon"><span class="annot"><span class="annottext">TypeableStuff -&gt; DataCon
</span><a href="GHC.Tc.Instance.Typeable.html#typeLitNatDataCon"><span class="hs-identifier hs-var hs-var">typeLitNatDataCon</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-373"></span><span>            </span><span class="hs-special">}</span><span>
</span><span id="line-374"></span><span>
</span><span id="line-375"></span><span class="hs-comment">-- | Collect various tidbits which we'll need to generate TyCon representations.</span><span>
</span><span id="line-376"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#collect_stuff"><span class="hs-identifier hs-type">collect_stuff</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableStuff"><span class="hs-identifier hs-type">TypeableStuff</span></a></span><span>
</span><span id="line-377"></span><span id="collect_stuff"><span class="annot"><span class="annottext">collect_stuff :: TcM TypeableStuff
</span><a href="GHC.Tc.Instance.Typeable.html#collect_stuff"><span class="hs-identifier hs-var hs-var">collect_stuff</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-378"></span><span>    </span><span id="local-6989586621681106527"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681106527"><span class="hs-identifier hs-var">platform</span></a></span></span><span>               </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; Platform)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) DynFlags
-&gt; IOEnv (Env TcGblEnv TcLclEnv) Platform
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-379"></span><span>    </span><span id="local-6989586621681106525"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106525"><span class="hs-identifier hs-var">trTyConDataCon</span></a></span></span><span>         </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#trTyConDataConName"><span class="hs-identifier hs-var">trTyConDataConName</span></a></span><span>
</span><span id="line-380"></span><span>    </span><span id="local-6989586621681106523"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106523"><span class="hs-identifier hs-var">kindRepTyCon</span></a></span></span><span>           </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span>   </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#kindRepTyConName"><span class="hs-identifier hs-var">kindRepTyConName</span></a></span><span>
</span><span id="line-381"></span><span>    </span><span id="local-6989586621681106522"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106522"><span class="hs-identifier hs-var">kindRepTyConAppDataCon</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#kindRepTyConAppDataConName"><span class="hs-identifier hs-var">kindRepTyConAppDataConName</span></a></span><span>
</span><span id="line-382"></span><span>    </span><span id="local-6989586621681106520"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106520"><span class="hs-identifier hs-var">kindRepVarDataCon</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#kindRepVarDataConName"><span class="hs-identifier hs-var">kindRepVarDataConName</span></a></span><span>
</span><span id="line-383"></span><span>    </span><span id="local-6989586621681106518"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106518"><span class="hs-identifier hs-var">kindRepAppDataCon</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#kindRepAppDataConName"><span class="hs-identifier hs-var">kindRepAppDataConName</span></a></span><span>
</span><span id="line-384"></span><span>    </span><span id="local-6989586621681106516"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106516"><span class="hs-identifier hs-var">kindRepFunDataCon</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#kindRepFunDataConName"><span class="hs-identifier hs-var">kindRepFunDataConName</span></a></span><span>
</span><span id="line-385"></span><span>    </span><span id="local-6989586621681106514"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106514"><span class="hs-identifier hs-var">kindRepTYPEDataCon</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#kindRepTYPEDataConName"><span class="hs-identifier hs-var">kindRepTYPEDataConName</span></a></span><span>
</span><span id="line-386"></span><span>    </span><span id="local-6989586621681106512"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106512"><span class="hs-identifier hs-var">kindRepTypeLitSDataCon</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#kindRepTypeLitSDataConName"><span class="hs-identifier hs-var">kindRepTypeLitSDataConName</span></a></span><span>
</span><span id="line-387"></span><span>    </span><span id="local-6989586621681106510"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106510"><span class="hs-identifier hs-var">typeLitSymbolDataCon</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#typeLitSymbolDataConName"><span class="hs-identifier hs-var">typeLitSymbolDataConName</span></a></span><span>
</span><span id="line-388"></span><span>    </span><span id="local-6989586621681106508"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106508"><span class="hs-identifier hs-var">typeLitNatDataCon</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#typeLitNatDataConName"><span class="hs-identifier hs-var">typeLitNatDataConName</span></a></span><span>
</span><span id="line-389"></span><span>    </span><span id="local-6989586621681106506"><span class="annot"><span class="annottext">FastString -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106506"><span class="hs-identifier hs-var">trNameLit</span></a></span></span><span>              </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM (FastString -&gt; LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkTrNameLit"><span class="hs-identifier hs-var">mkTrNameLit</span></a></span><span>
</span><span id="line-390"></span><span>    </span><span class="annot"><span class="annottext">TypeableStuff -&gt; TcM TypeableStuff
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Stuff :: Platform
-&gt; DataCon
-&gt; (FastString -&gt; LHsExpr (GhcPass 'Typechecked))
-&gt; TyCon
-&gt; DataCon
-&gt; DataCon
-&gt; DataCon
-&gt; DataCon
-&gt; DataCon
-&gt; DataCon
-&gt; DataCon
-&gt; DataCon
-&gt; TypeableStuff
</span><a href="GHC.Tc.Instance.Typeable.html#Stuff"><span class="hs-identifier hs-type">Stuff</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">Platform
TyCon
DataCon
FastString -&gt; LHsExpr (GhcPass 'Typechecked)
trNameLit :: FastString -&gt; LHsExpr (GhcPass 'Typechecked)
typeLitNatDataCon :: DataCon
typeLitSymbolDataCon :: DataCon
kindRepTypeLitSDataCon :: DataCon
kindRepTYPEDataCon :: DataCon
kindRepFunDataCon :: DataCon
kindRepAppDataCon :: DataCon
kindRepVarDataCon :: DataCon
kindRepTyConAppDataCon :: DataCon
kindRepTyCon :: TyCon
trTyConDataCon :: DataCon
platform :: Platform
typeLitNatDataCon :: DataCon
typeLitSymbolDataCon :: DataCon
kindRepTypeLitSDataCon :: DataCon
kindRepTYPEDataCon :: DataCon
kindRepFunDataCon :: DataCon
kindRepAppDataCon :: DataCon
kindRepVarDataCon :: DataCon
kindRepTyConAppDataCon :: DataCon
kindRepTyCon :: TyCon
trNameLit :: FastString -&gt; LHsExpr (GhcPass 'Typechecked)
trTyConDataCon :: DataCon
platform :: Platform
</span><a href="#local-6989586621681106506"><span class="hs-glyph hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">..</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-391"></span><span>
</span><span id="line-392"></span><span class="hs-comment">-- | Lookup the necessary pieces to construct the @trNameLit@. We do this so we</span><span>
</span><span id="line-393"></span><span class="hs-comment">-- can save the work of repeating lookups when constructing many TyCon</span><span>
</span><span id="line-394"></span><span class="hs-comment">-- representations.</span><span>
</span><span id="line-395"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkTrNameLit"><span class="hs-identifier hs-type">mkTrNameLit</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-396"></span><span id="mkTrNameLit"><span class="annot"><span class="annottext">mkTrNameLit :: TcM (FastString -&gt; LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkTrNameLit"><span class="hs-identifier hs-var hs-var">mkTrNameLit</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-397"></span><span>    </span><span id="local-6989586621681106505"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106505"><span class="hs-identifier hs-var">trNameSDataCon</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#trNameSDataConName"><span class="hs-identifier hs-var">trNameSDataConName</span></a></span><span>
</span><span id="line-398"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="#local-6989586621681106503"><span class="hs-identifier hs-type">trNameLit</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-399"></span><span>        </span><span id="local-6989586621681106503"><span class="annot"><span class="annottext">trNameLit :: FastString -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106503"><span class="hs-identifier hs-var hs-var">trNameLit</span></a></span></span><span> </span><span id="local-6989586621681106502"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681106502"><span class="hs-identifier hs-var">fs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass). LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsPar"><span class="hs-identifier hs-var">nlHsPar</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked))
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106505"><span class="hs-identifier hs-var">trNameSDataCon</span></a></span><span>
</span><span id="line-400"></span><span>                       </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">HsLit (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (p :: Pass). HsLit (GhcPass p) -&gt; LHsExpr (GhcPass p)
</span><a href="GHC.Hs.Utils.html#nlHsLit"><span class="hs-identifier hs-var">nlHsLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; HsLit (GhcPass 'Typechecked)
forall (p :: Pass). FastString -&gt; HsLit (GhcPass p)
</span><a href="GHC.Hs.Utils.html#mkHsStringPrimLit"><span class="hs-identifier hs-var">mkHsStringPrimLit</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681106502"><span class="hs-identifier hs-var">fs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-401"></span><span>    </span><span class="annot"><span class="annottext">(FastString -&gt; LHsExpr (GhcPass 'Typechecked))
-&gt; TcM (FastString -&gt; LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106503"><span class="hs-identifier hs-var">trNameLit</span></a></span><span>
</span><span id="line-402"></span><span>
</span><span id="line-403"></span><span class="hs-comment">-- | Make Typeable bindings for the given 'TyCon'.</span><span>
</span><span id="line-404"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkTyConRepBinds"><span class="hs-identifier hs-type">mkTyConRepBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableStuff"><span class="hs-identifier hs-type">TypeableStuff</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span>
</span><span id="line-405"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableTyCon"><span class="hs-identifier hs-type">TypeableTyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-406"></span><span id="mkTyConRepBinds"><span class="annot"><span class="annottext">mkTyConRepBinds :: TypeableStuff
-&gt; TypeRepTodo
-&gt; TypeableTyCon
-&gt; KindRepM (LHsBinds (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkTyConRepBinds"><span class="hs-identifier hs-var hs-var">mkTyConRepBinds</span></a></span></span><span> </span><span id="local-6989586621681106498"><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106498"><span class="hs-identifier hs-var">stuff</span></a></span></span><span> </span><span id="local-6989586621681106497"><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106497"><span class="hs-identifier hs-var">todo</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableTyCon"><span class="hs-identifier hs-type">TypeableTyCon</span></a></span><span> </span><span class="hs-special">{</span><span id="local-6989586621681106495"><span id="local-6989586621681106496"><span class="annot"><span class="annottext">Var
TyCon
tycon_rep_id :: Var
tycon :: TyCon
tycon_rep_id :: TypeableTyCon -&gt; Var
tycon :: TypeableTyCon -&gt; TyCon
</span><a href="#local-6989586621681106495"><span class="hs-glyph hs-var hs-var hs-var hs-var">..</span></a></span></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-407"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-comment">-- Make a KindRep</span><span>
</span><span id="line-408"></span><span>       </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106494"><span class="annot"><span class="annottext">[TyCoVarBinder]
</span><a href="#local-6989586621681106494"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106493"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106493"><span class="hs-identifier hs-var">kind</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; ([TyCoVarBinder], Kind)
</span><a href="GHC.Core.Type.html#splitForAllVarBndrs"><span class="hs-identifier hs-var">splitForAllVarBndrs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Kind
</span><a href="GHC.Core.TyCon.html#tyConKind"><span class="hs-identifier hs-var hs-var">tyConKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106496"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-409"></span><span>       </span><span class="annot"><span class="annottext">TcRn () -&gt; KindRepM ()
forall a. TcRn a -&gt; KindRepM a
</span><a href="GHC.Tc.Instance.Typeable.html#liftTc"><span class="hs-identifier hs-var">liftTc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; KindRepM ()) -&gt; TcRn () -&gt; KindRepM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkTyConKindRepBinds&quot;</span></span><span>
</span><span id="line-410"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106496"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Kind
</span><a href="GHC.Core.TyCon.html#tyConKind"><span class="hs-identifier hs-var hs-var">tyConKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106496"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106493"><span class="hs-identifier hs-var">kind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-411"></span><span>       </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106488"><span class="annot"><span class="annottext">ctx :: CmEnv
</span><a href="#local-6989586621681106488"><span class="hs-identifier hs-var hs-var">ctx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; CmEnv
</span><a href="GHC.Core.Map.html#mkDeBruijnContext"><span class="hs-identifier hs-var">mkDeBruijnContext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TyCoVarBinder -&gt; Var) -&gt; [TyCoVarBinder] -&gt; [Var]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVarBinder -&gt; Var
forall tv argf. VarBndr tv argf -&gt; tv
</span><a href="GHC.Types.Var.html#binderVar"><span class="hs-identifier hs-var">binderVar</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVarBinder]
</span><a href="#local-6989586621681106494"><span class="hs-identifier hs-var">bndrs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-412"></span><span>       </span><span id="local-6989586621681106485"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106485"><span class="hs-identifier hs-var">kind_rep</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#getKindRep"><span class="hs-identifier hs-var">getKindRep</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106498"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106488"><span class="hs-identifier hs-var">ctx</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106493"><span class="hs-identifier hs-var">kind</span></a></span><span>
</span><span id="line-413"></span><span>
</span><span id="line-414"></span><span>       </span><span class="hs-comment">-- Make the TyCon binding</span><span>
</span><span id="line-415"></span><span>       </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106483"><span class="annot"><span class="annottext">tycon_rep_rhs :: LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106483"><span class="hs-identifier hs-var hs-var">tycon_rep_rhs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeableStuff
-&gt; TypeRepTodo
-&gt; TyCon
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#mkTyConRepTyConRHS"><span class="hs-identifier hs-var">mkTyConRepTyConRHS</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106498"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106497"><span class="hs-identifier hs-var">todo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106496"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106485"><span class="hs-identifier hs-var">kind_rep</span></a></span><span>
</span><span id="line-416"></span><span>           </span><span id="local-6989586621681106481"><span class="annot"><span class="annottext">tycon_rep_bind :: LHsBind (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106481"><span class="hs-identifier hs-var hs-var">tycon_rep_bind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsBind (GhcPass 'Typechecked)
forall (p :: Pass).
IdP (GhcPass p) -&gt; LHsExpr (GhcPass p) -&gt; LHsBind (GhcPass p)
</span><a href="GHC.Hs.Utils.html#mkVarBind"><span class="hs-identifier hs-var">mkVarBind</span></a></span><span> </span><span class="annot"><span class="annottext">Var
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106495"><span class="hs-identifier hs-var">tycon_rep_id</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106483"><span class="hs-identifier hs-var">tycon_rep_rhs</span></a></span><span>
</span><span id="line-417"></span><span>       </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
-&gt; KindRepM (LHsBinds (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked)
 -&gt; KindRepM (LHsBinds (GhcPass 'Typechecked)))
-&gt; LHsBinds (GhcPass 'Typechecked)
-&gt; KindRepM (LHsBinds (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Typechecked) -&gt; LHsBinds (GhcPass 'Typechecked)
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106481"><span class="hs-identifier hs-var">tycon_rep_bind</span></a></span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span class="hs-comment">-- | Is a particular 'TyCon' representable by @Typeable@?. These exclude type</span><span>
</span><span id="line-420"></span><span class="hs-comment">-- families and polytypes.</span><span>
</span><span id="line-421"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#tyConIsTypeable"><span class="hs-identifier hs-type">tyConIsTypeable</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-422"></span><span id="tyConIsTypeable"><span class="annot"><span class="annottext">tyConIsTypeable :: TyCon -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#tyConIsTypeable"><span class="hs-identifier hs-var hs-var">tyConIsTypeable</span></a></span></span><span> </span><span id="local-6989586621681106480"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106480"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-423"></span><span>       </span><span class="annot"><span class="annottext">Maybe Name -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Maybe Name
</span><a href="GHC.Core.TyCon.html#tyConRepName_maybe"><span class="hs-identifier hs-var">tyConRepName_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106480"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-424"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; Kind
</span><a href="GHC.Core.Type.html#dropForAlls"><span class="hs-identifier hs-var">dropForAlls</span></a></span><span> </span><span class="annot"><span class="annottext">(Kind -&gt; Kind) -&gt; Kind -&gt; Kind
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Kind
</span><a href="GHC.Core.TyCon.html#tyConKind"><span class="hs-identifier hs-var hs-var">tyConKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106480"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-425"></span><span>
</span><span id="line-426"></span><span class="hs-comment">-- | Is a particular 'Kind' representable by @Typeable@? Here we look for</span><span>
</span><span id="line-427"></span><span class="hs-comment">-- polytypes and types containing casts (which may be, for instance, a type</span><span>
</span><span id="line-428"></span><span class="hs-comment">-- family).</span><span>
</span><span id="line-429"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-type">kindIsTypeable</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-430"></span><span class="hs-comment">-- We handle types of the form (TYPE LiftedRep) specifically to avoid</span><span>
</span><span id="line-431"></span><span class="hs-comment">-- looping on (tyConIsTypeable RuntimeRep). We used to consider (TYPE rr)</span><span>
</span><span id="line-432"></span><span class="hs-comment">-- to be typeable without inspecting rr, but this exhibits bad behavior</span><span>
</span><span id="line-433"></span><span class="hs-comment">-- when rr is a type family.</span><span>
</span><span id="line-434"></span><span id="kindIsTypeable"><span class="annot"><span class="annottext">kindIsTypeable :: Kind -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var hs-var">kindIsTypeable</span></a></span></span><span> </span><span id="local-6989586621681106476"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106476"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-435"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681106475"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106475"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Maybe Kind
</span><a href="GHC.Core.Type.html#coreView"><span class="hs-identifier hs-var">coreView</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106476"><span class="hs-identifier hs-var">ty</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106475"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-436"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span id="local-6989586621681106473"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106473"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-437"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Core.Type.html#isLiftedTypeKind"><span class="hs-identifier hs-var">isLiftedTypeKind</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106473"><span class="hs-identifier hs-var">ty</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-438"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-439"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621681106469"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106469"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681106468"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106468"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106469"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106468"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-440"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681106466"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106466"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621681106465"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106465"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681106464"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106464"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106466"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-441"></span><span>                                      </span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106465"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-442"></span><span>                                      </span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106464"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-443"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621681106462"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106462"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621681106461"><span class="annot"><span class="annottext">[Kind]
</span><a href="#local-6989586621681106461"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#tyConIsTypeable"><span class="hs-identifier hs-var">tyConIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106462"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-444"></span><span>                                   </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(Kind -&gt; Bool) -&gt; [Kind] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="annot"><span class="annottext">[Kind]
</span><a href="#local-6989586621681106461"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-445"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-446"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyLit
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-447"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-448"></span><span>  </span><span class="hs-comment">-- See Note [Typeable instances for casted types]</span><span>
</span><span id="line-449"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#kindIsTypeable"><span class="hs-identifier hs-var">kindIsTypeable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span class="hs-comment">-- | Maps kinds to 'KindRep' bindings. This binding may either be defined in</span><span>
</span><span id="line-452"></span><span class="hs-comment">-- some other module (in which case the @Maybe (LHsExpr Id@ will be 'Nothing')</span><span>
</span><span id="line-453"></span><span class="hs-comment">-- or a binding which we generated in the current module (in which case it will</span><span>
</span><span id="line-454"></span><span class="hs-comment">-- be 'Just' the RHS of the binding).</span><span>
</span><span id="line-455"></span><span class="hs-keyword">type</span><span> </span><span id="KindRepEnv"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepEnv"><span class="hs-identifier hs-var">KindRepEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.Map.html#TypeMap"><span class="hs-identifier hs-type">TypeMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-456"></span><span>
</span><span id="line-457"></span><span class="hs-comment">-- | A monad within which we will generate 'KindRep's. Here we keep an</span><span>
</span><span id="line-458"></span><span class="hs-comment">-- environment containing 'KindRep's which we've already generated so we can</span><span>
</span><span id="line-459"></span><span class="hs-comment">-- re-use them opportunistically.</span><span>
</span><span id="line-460"></span><span class="hs-keyword">newtype</span><span> </span><span id="KindRepM"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-var">KindRepM</span></a></span></span><span> </span><span id="local-6989586621681107019"><span class="annot"><a href="#local-6989586621681107019"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="KindRepM"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-var">KindRepM</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="unKindRepM"><span class="annot"><span class="annottext">forall a. KindRepM a -&gt; StateT KindRepEnv TcRn a
</span><a href="GHC.Tc.Instance.Typeable.html#unKindRepM"><span class="hs-identifier hs-var hs-var">unKindRepM</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../transformers/src/Control.Monad.Trans.State.Lazy.html#StateT"><span class="hs-identifier hs-type">StateT</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepEnv"><span class="hs-identifier hs-type">KindRepEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681107019"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-461"></span><span>                   </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106447"><span id="local-6989586621681106452"><span class="annot"><span class="annottext">(forall a b. (a -&gt; b) -&gt; KindRepM a -&gt; KindRepM b)
-&gt; (forall a b. a -&gt; KindRepM b -&gt; KindRepM a) -&gt; Functor KindRepM
forall a b. a -&gt; KindRepM b -&gt; KindRepM a
forall a b. (a -&gt; b) -&gt; KindRepM a -&gt; KindRepM b
forall (f :: * -&gt; *).
(forall a b. (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b. a -&gt; f b -&gt; f a) -&gt; Functor f
&lt;$ :: forall a b. a -&gt; KindRepM b -&gt; KindRepM a
$c&lt;$ :: forall a b. a -&gt; KindRepM b -&gt; KindRepM a
fmap :: forall a b. (a -&gt; b) -&gt; KindRepM a -&gt; KindRepM b
$cfmap :: forall a b. (a -&gt; b) -&gt; KindRepM a -&gt; KindRepM b
</span><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Functor</span></a></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106422"><span id="local-6989586621681106426"><span id="local-6989586621681106430"><span id="local-6989586621681106434"><span id="local-6989586621681106439"><span class="annot"><span class="annottext">Functor KindRepM
Functor KindRepM
-&gt; (forall a. a -&gt; KindRepM a)
-&gt; (forall a b. KindRepM (a -&gt; b) -&gt; KindRepM a -&gt; KindRepM b)
-&gt; (forall a b c.
    (a -&gt; b -&gt; c) -&gt; KindRepM a -&gt; KindRepM b -&gt; KindRepM c)
-&gt; (forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM b)
-&gt; (forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM a)
-&gt; Applicative KindRepM
forall a. a -&gt; KindRepM a
forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM a
forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM b
forall a b. KindRepM (a -&gt; b) -&gt; KindRepM a -&gt; KindRepM b
forall a b c.
(a -&gt; b -&gt; c) -&gt; KindRepM a -&gt; KindRepM b -&gt; KindRepM c
forall (f :: * -&gt; *).
Functor f
-&gt; (forall a. a -&gt; f a)
-&gt; (forall a b. f (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b c. (a -&gt; b -&gt; c) -&gt; f a -&gt; f b -&gt; f c)
-&gt; (forall a b. f a -&gt; f b -&gt; f b)
-&gt; (forall a b. f a -&gt; f b -&gt; f a)
-&gt; Applicative f
&lt;* :: forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM a
$c&lt;* :: forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM a
*&gt; :: forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM b
$c*&gt; :: forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM b
liftA2 :: forall a b c.
(a -&gt; b -&gt; c) -&gt; KindRepM a -&gt; KindRepM b -&gt; KindRepM c
$cliftA2 :: forall a b c.
(a -&gt; b -&gt; c) -&gt; KindRepM a -&gt; KindRepM b -&gt; KindRepM c
&lt;*&gt; :: forall a b. KindRepM (a -&gt; b) -&gt; KindRepM a -&gt; KindRepM b
$c&lt;*&gt; :: forall a b. KindRepM (a -&gt; b) -&gt; KindRepM a -&gt; KindRepM b
pure :: forall a. a -&gt; KindRepM a
$cpure :: forall a. a -&gt; KindRepM a
</span><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Applicative</span></a></span></span></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106405"><span id="local-6989586621681106409"><span id="local-6989586621681106414"><span class="annot"><span class="annottext">Applicative KindRepM
Applicative KindRepM
-&gt; (forall a b. KindRepM a -&gt; (a -&gt; KindRepM b) -&gt; KindRepM b)
-&gt; (forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM b)
-&gt; (forall a. a -&gt; KindRepM a)
-&gt; Monad KindRepM
forall a. a -&gt; KindRepM a
forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM b
forall a b. KindRepM a -&gt; (a -&gt; KindRepM b) -&gt; KindRepM b
forall (m :: * -&gt; *).
Applicative m
-&gt; (forall a b. m a -&gt; (a -&gt; m b) -&gt; m b)
-&gt; (forall a b. m a -&gt; m b -&gt; m b)
-&gt; (forall a. a -&gt; m a)
-&gt; Monad m
return :: forall a. a -&gt; KindRepM a
$creturn :: forall a. a -&gt; KindRepM a
&gt;&gt; :: forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM b
$c&gt;&gt; :: forall a b. KindRepM a -&gt; KindRepM b -&gt; KindRepM b
&gt;&gt;= :: forall a b. KindRepM a -&gt; (a -&gt; KindRepM b) -&gt; KindRepM b
$c&gt;&gt;= :: forall a b. KindRepM a -&gt; (a -&gt; KindRepM b) -&gt; KindRepM b
</span><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Monad</span></a></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-462"></span><span>
</span><span id="line-463"></span><span id="local-6989586621681107029"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#liftTc"><span class="hs-identifier hs-type">liftTc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681107029"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681107029"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-464"></span><span id="liftTc"><span class="annot"><span class="annottext">liftTc :: forall a. TcRn a -&gt; KindRepM a
</span><a href="GHC.Tc.Instance.Typeable.html#liftTc"><span class="hs-identifier hs-var hs-var">liftTc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StateT KindRepEnv TcRn a -&gt; KindRepM a
forall a. StateT KindRepEnv TcRn a -&gt; KindRepM a
</span><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-var">KindRepM</span></a></span><span> </span><span class="annot"><span class="annottext">(StateT KindRepEnv TcRn a -&gt; KindRepM a)
-&gt; (TcRn a -&gt; StateT KindRepEnv TcRn a) -&gt; TcRn a -&gt; KindRepM a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">TcRn a -&gt; StateT KindRepEnv TcRn a
forall (t :: (* -&gt; *) -&gt; * -&gt; *) (m :: * -&gt; *) a.
(MonadTrans t, Monad m) =&gt;
m a -&gt; t m a
</span><a href="../../transformers/src/Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var">lift</span></a></span><span>
</span><span id="line-465"></span><span>
</span><span id="line-466"></span><span class="hs-comment">-- | We generate @KindRep@s for a few common kinds in @GHC.Types@ so that they</span><span>
</span><span id="line-467"></span><span class="hs-comment">-- can be reused across modules.</span><span>
</span><span id="line-468"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#builtInKindReps"><span class="hs-identifier hs-type">builtInKindReps</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-469"></span><span id="builtInKindReps"><span class="annot"><span class="annottext">builtInKindReps :: [(Kind, Name)]
</span><a href="GHC.Tc.Instance.Typeable.html#builtInKindReps"><span class="hs-identifier hs-var hs-var">builtInKindReps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-470"></span><span>    </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106397"><span class="hs-identifier hs-var">star</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#starKindRepName"><span class="hs-identifier hs-var">starKindRepName</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-471"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; Kind -&gt; Kind
</span><a href="GHC.Core.TyCo.Rep.html#mkVisFunTyMany"><span class="hs-identifier hs-var">mkVisFunTyMany</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106397"><span class="hs-identifier hs-var">star</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106397"><span class="hs-identifier hs-var">star</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#starArrStarKindRepName"><span class="hs-identifier hs-var">starArrStarKindRepName</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-472"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Kind] -&gt; Kind -&gt; Kind
</span><a href="GHC.Core.TyCo.Rep.html#mkVisFunTysMany"><span class="hs-identifier hs-var">mkVisFunTysMany</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106397"><span class="hs-identifier hs-var">star</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106397"><span class="hs-identifier hs-var">star</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106397"><span class="hs-identifier hs-var">star</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#starArrStarArrStarKindRepName"><span class="hs-identifier hs-var">starArrStarArrStarKindRepName</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-473"></span><span>    </span><span class="hs-special">]</span><span>
</span><span id="line-474"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-475"></span><span>    </span><span id="local-6989586621681106397"><span class="annot"><span class="annottext">star :: Kind
</span><a href="#local-6989586621681106397"><span class="hs-identifier hs-var hs-var">star</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Builtin.Types.html#liftedTypeKind"><span class="hs-identifier hs-var">liftedTypeKind</span></a></span><span>
</span><span id="line-476"></span><span>
</span><span id="line-477"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#initialKindRepEnv"><span class="hs-identifier hs-type">initialKindRepEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepEnv"><span class="hs-identifier hs-type">KindRepEnv</span></a></span><span>
</span><span id="line-478"></span><span id="initialKindRepEnv"><span class="annot"><span class="annottext">initialKindRepEnv :: TcRn KindRepEnv
</span><a href="GHC.Tc.Instance.Typeable.html#initialKindRepEnv"><span class="hs-identifier hs-var hs-var">initialKindRepEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(KindRepEnv -&gt; (Kind, Name) -&gt; TcRn KindRepEnv)
-&gt; KindRepEnv -&gt; [(Kind, Name)] -&gt; TcRn KindRepEnv
forall (t :: * -&gt; *) (m :: * -&gt; *) b a.
(Foldable t, Monad m) =&gt;
(b -&gt; a -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Data.Foldable.html#foldlM"><span class="hs-identifier hs-var">foldlM</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepEnv -&gt; (Kind, Name) -&gt; TcRn KindRepEnv
forall {a}.
TypeMap (Var, Maybe a)
-&gt; (Kind, Name)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (TypeMap (Var, Maybe a))
</span><a href="#local-6989586621681106388"><span class="hs-identifier hs-var">add_kind_rep</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepEnv
forall a. TypeMap a
</span><a href="GHC.Core.Map.html#emptyTypeMap"><span class="hs-identifier hs-var">emptyTypeMap</span></a></span><span> </span><span class="annot"><span class="annottext">[(Kind, Name)]
</span><a href="GHC.Tc.Instance.Typeable.html#builtInKindReps"><span class="hs-identifier hs-var">builtInKindReps</span></a></span><span>
</span><span id="line-479"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-480"></span><span>    </span><span id="local-6989586621681106388"><span class="annot"><span class="annottext">add_kind_rep :: TypeMap (Var, Maybe a)
-&gt; (Kind, Name)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (TypeMap (Var, Maybe a))
</span><a href="#local-6989586621681106388"><span class="hs-identifier hs-var hs-var">add_kind_rep</span></a></span></span><span> </span><span id="local-6989586621681106384"><span class="annot"><span class="annottext">TypeMap (Var, Maybe a)
</span><a href="#local-6989586621681106384"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106383"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106383"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681106382"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106382"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-481"></span><span>        </span><span id="local-6989586621681106381"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106381"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM Var
</span><a href="GHC.Tc.Utils.Env.html#tcLookupId"><span class="hs-identifier hs-var">tcLookupId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106382"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-482"></span><span>        </span><span class="annot"><span class="annottext">TypeMap (Var, Maybe a)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (TypeMap (Var, Maybe a))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(TypeMap (Var, Maybe a)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (TypeMap (Var, Maybe a)))
-&gt; TypeMap (Var, Maybe a)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (TypeMap (Var, Maybe a))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">TypeMap (Var, Maybe a)
-&gt; Kind -&gt; (Var, Maybe a) -&gt; TypeMap (Var, Maybe a)
forall a. TypeMap a -&gt; Kind -&gt; a -&gt; TypeMap a
</span><a href="GHC.Core.Map.html#extendTypeMap"><span class="hs-identifier hs-var">extendTypeMap</span></a></span><span> </span><span class="annot"><span class="annottext">TypeMap (Var, Maybe a)
</span><a href="#local-6989586621681106384"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106383"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106381"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-483"></span><span>
</span><span id="line-484"></span><span class="hs-comment">-- | Performed while compiling &quot;GHC.Types&quot; to generate the built-in 'KindRep's.</span><span>
</span><span id="line-485"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkExportedKindReps"><span class="hs-identifier hs-type">mkExportedKindReps</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableStuff"><span class="hs-identifier hs-type">TypeableStuff</span></a></span><span>
</span><span id="line-486"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- ^ the kinds to generate bindings for</span><span>
</span><span id="line-487"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-488"></span><span id="mkExportedKindReps"><span class="annot"><span class="annottext">mkExportedKindReps :: TypeableStuff -&gt; [(Kind, Var)] -&gt; KindRepM ()
</span><a href="GHC.Tc.Instance.Typeable.html#mkExportedKindReps"><span class="hs-identifier hs-var hs-var">mkExportedKindReps</span></a></span></span><span> </span><span id="local-6989586621681106377"><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106377"><span class="hs-identifier hs-var">stuff</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Kind, Var) -&gt; KindRepM ()) -&gt; [(Kind, Var)] -&gt; KindRepM ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">(Kind, Var) -&gt; KindRepM ()
</span><a href="#local-6989586621681106375"><span class="hs-identifier hs-var">kindrep_binding</span></a></span><span>
</span><span id="line-489"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-490"></span><span>    </span><span id="local-6989586621681106374"><span class="annot"><span class="annottext">empty_scope :: CmEnv
</span><a href="#local-6989586621681106374"><span class="hs-identifier hs-var hs-var">empty_scope</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; CmEnv
</span><a href="GHC.Core.Map.html#mkDeBruijnContext"><span class="hs-identifier hs-var">mkDeBruijnContext</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-491"></span><span>
</span><span id="line-492"></span><span>    </span><span class="annot"><a href="#local-6989586621681106375"><span class="hs-identifier hs-type">kindrep_binding</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-493"></span><span>    </span><span id="local-6989586621681106375"><span class="annot"><span class="annottext">kindrep_binding :: (Kind, Var) -&gt; KindRepM ()
</span><a href="#local-6989586621681106375"><span class="hs-identifier hs-var hs-var">kindrep_binding</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106373"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106373"><span class="hs-identifier hs-var">kind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106372"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106372"><span class="hs-identifier hs-var">rep_bndr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-494"></span><span>        </span><span class="hs-comment">-- We build the binding manually here instead of using mkKindRepRhs</span><span>
</span><span id="line-495"></span><span>        </span><span class="hs-comment">-- since the latter would find the built-in 'KindRep's in the</span><span>
</span><span id="line-496"></span><span>        </span><span class="hs-comment">-- 'KindRepEnv' (by virtue of being in 'initialKindRepEnv').</span><span>
</span><span id="line-497"></span><span>        </span><span id="local-6989586621681106371"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106371"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkKindRepRhs"><span class="hs-identifier hs-var">mkKindRepRhs</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106377"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106374"><span class="hs-identifier hs-var">empty_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106373"><span class="hs-identifier hs-var">kind</span></a></span><span>
</span><span id="line-498"></span><span>        </span><span class="annot"><span class="annottext">CmEnv
-&gt; Kind -&gt; Var -&gt; LHsExpr (GhcPass 'Typechecked) -&gt; KindRepM ()
</span><a href="GHC.Tc.Instance.Typeable.html#addKindRepBind"><span class="hs-identifier hs-var">addKindRepBind</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106374"><span class="hs-identifier hs-var">empty_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106373"><span class="hs-identifier hs-var">kind</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106372"><span class="hs-identifier hs-var">rep_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106371"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-499"></span><span>
</span><span id="line-500"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#addKindRepBind"><span class="hs-identifier hs-type">addKindRepBind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Map.html#CmEnv"><span class="hs-identifier hs-type">CmEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-501"></span><span id="addKindRepBind"><span class="annot"><span class="annottext">addKindRepBind :: CmEnv
-&gt; Kind -&gt; Var -&gt; LHsExpr (GhcPass 'Typechecked) -&gt; KindRepM ()
</span><a href="GHC.Tc.Instance.Typeable.html#addKindRepBind"><span class="hs-identifier hs-var hs-var">addKindRepBind</span></a></span></span><span> </span><span id="local-6989586621681106368"><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106368"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span> </span><span id="local-6989586621681106367"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106367"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621681106366"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106366"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621681106365"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106365"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-502"></span><span>    </span><span class="annot"><span class="annottext">StateT KindRepEnv TcRn () -&gt; KindRepM ()
forall a. StateT KindRepEnv TcRn a -&gt; KindRepM a
</span><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-var">KindRepM</span></a></span><span> </span><span class="annot"><span class="annottext">(StateT KindRepEnv TcRn () -&gt; KindRepM ())
-&gt; StateT KindRepEnv TcRn () -&gt; KindRepM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(KindRepEnv -&gt; KindRepEnv) -&gt; StateT KindRepEnv TcRn ()
forall (m :: * -&gt; *) s. Monad m =&gt; (s -&gt; s) -&gt; StateT s m ()
</span><a href="../../transformers/src/Control.Monad.Trans.State.Lazy.html#modify%27"><span class="hs-identifier hs-var">modify'</span></a></span><span> </span><span class="annot"><span class="annottext">((KindRepEnv -&gt; KindRepEnv) -&gt; StateT KindRepEnv TcRn ())
-&gt; (KindRepEnv -&gt; KindRepEnv) -&gt; StateT KindRepEnv TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-503"></span><span>    </span><span class="hs-glyph">\</span><span id="local-6989586621681106363"><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106363"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">KindRepEnv
-&gt; CmEnv
-&gt; Kind
-&gt; (Var, Maybe (LHsExpr (GhcPass 'Typechecked)))
-&gt; KindRepEnv
forall a. TypeMap a -&gt; CmEnv -&gt; Kind -&gt; a -&gt; TypeMap a
</span><a href="GHC.Core.Map.html#extendTypeMapWithScope"><span class="hs-identifier hs-var">extendTypeMapWithScope</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106363"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106368"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106367"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106366"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; Maybe (LHsExpr (GhcPass 'Typechecked))
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106365"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-504"></span><span>
</span><span id="line-505"></span><span class="hs-comment">-- | Run a 'KindRepM' and add the produced 'KindRep's to the typechecking</span><span>
</span><span id="line-506"></span><span class="hs-comment">-- environment.</span><span>
</span><span id="line-507"></span><span id="local-6989586621681107040"><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#runKindRepM"><span class="hs-identifier hs-type">runKindRepM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681107040"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681107040"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-508"></span><span id="runKindRepM"><span class="annot"><span class="annottext">runKindRepM :: forall a. KindRepM a -&gt; TcRn (TcGblEnv, a)
</span><a href="GHC.Tc.Instance.Typeable.html#runKindRepM"><span class="hs-identifier hs-var hs-var">runKindRepM</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span id="local-6989586621681106357"><span class="annot"><span class="annottext">StateT KindRepEnv TcRn a
</span><a href="#local-6989586621681106357"><span class="hs-identifier hs-var">action</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-509"></span><span>    </span><span id="local-6989586621681106356"><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106356"><span class="hs-identifier hs-var">kindRepEnv</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRn KindRepEnv
</span><a href="GHC.Tc.Instance.Typeable.html#initialKindRepEnv"><span class="hs-identifier hs-var">initialKindRepEnv</span></a></span><span>
</span><span id="line-510"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681106355"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681106355"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681106354"><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106354"><span class="hs-identifier hs-var">reps_env</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">StateT KindRepEnv TcRn a -&gt; KindRepEnv -&gt; TcRn (a, KindRepEnv)
forall s (m :: * -&gt; *) a. StateT s m a -&gt; s -&gt; m (a, s)
</span><a href="../../transformers/src/Control.Monad.Trans.State.Lazy.html#runStateT"><span class="hs-identifier hs-var hs-var">runStateT</span></a></span><span> </span><span class="annot"><span class="annottext">StateT KindRepEnv TcRn a
</span><a href="#local-6989586621681106357"><span class="hs-identifier hs-var">action</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106356"><span class="hs-identifier hs-var">kindRepEnv</span></a></span><span>
</span><span id="line-511"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106352"><span class="annot"><span class="annottext">rep_binds :: [(Var, LHsExpr (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681106352"><span class="hs-identifier hs-var hs-var">rep_binds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Var, Maybe (LHsExpr (GhcPass 'Typechecked)))
 -&gt; [(Var, LHsExpr (GhcPass 'Typechecked))]
 -&gt; [(Var, LHsExpr (GhcPass 'Typechecked))])
-&gt; [(Var, LHsExpr (GhcPass 'Typechecked))]
-&gt; KindRepEnv
-&gt; [(Var, LHsExpr (GhcPass 'Typechecked))]
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; TypeMap a -&gt; b
</span><a href="GHC.Core.Map.html#foldTypeMap"><span class="hs-identifier hs-var">foldTypeMap</span></a></span><span> </span><span class="annot"><span class="annottext">(Var, Maybe (LHsExpr (GhcPass 'Typechecked)))
-&gt; [(Var, LHsExpr (GhcPass 'Typechecked))]
-&gt; [(Var, LHsExpr (GhcPass 'Typechecked))]
forall {a} {b}. (a, Maybe b) -&gt; [(a, b)] -&gt; [(a, b)]
</span><a href="#local-6989586621681106350"><span class="hs-identifier hs-var">to_bind_pair</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106354"><span class="hs-identifier hs-var">reps_env</span></a></span><span>
</span><span id="line-512"></span><span>        </span><span id="local-6989586621681106350"><span class="annot"><span class="annottext">to_bind_pair :: (a, Maybe b) -&gt; [(a, b)] -&gt; [(a, b)]
</span><a href="#local-6989586621681106350"><span class="hs-identifier hs-var hs-var">to_bind_pair</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106349"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681106349"><span class="hs-identifier hs-var">bndr</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681106348"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681106348"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681106347"><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621681106347"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681106349"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681106348"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(a, b) -&gt; [(a, b)] -&gt; [(a, b)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621681106347"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-513"></span><span>        </span><span class="annot"><a href="#local-6989586621681106350"><span class="hs-identifier hs-var">to_bind_pair</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe b
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681106346"><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621681106346"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621681106346"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-514"></span><span>    </span><span id="local-6989586621681106345"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106345"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; TcM TcGblEnv -&gt; TcM TcGblEnv
forall a. [Var] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendGlobalValEnv"><span class="hs-identifier hs-var">tcExtendGlobalValEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Var, LHsExpr (GhcPass 'Typechecked)) -&gt; Var)
-&gt; [(Var, LHsExpr (GhcPass 'Typechecked))] -&gt; [Var]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Var, LHsExpr (GhcPass 'Typechecked)) -&gt; Var
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Var, LHsExpr (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681106352"><span class="hs-identifier hs-var">rep_binds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcM TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-515"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681106344"><span class="annot"><span class="annottext">binds :: [LHsBind (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681106344"><span class="hs-identifier hs-var hs-var">binds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Var, LHsExpr (GhcPass 'Typechecked))
 -&gt; LHsBind (GhcPass 'Typechecked))
-&gt; [(Var, LHsExpr (GhcPass 'Typechecked))]
-&gt; [LHsBind (GhcPass 'Typechecked)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Var
 -&gt; LHsExpr (GhcPass 'Typechecked)
 -&gt; LHsBind (GhcPass 'Typechecked))
-&gt; (Var, LHsExpr (GhcPass 'Typechecked))
-&gt; LHsBind (GhcPass 'Typechecked)
forall a b c. (a -&gt; b -&gt; c) -&gt; (a, b) -&gt; c
</span><a href="../../base/src/Data.Tuple.html#uncurry"><span class="hs-identifier hs-var">uncurry</span></a></span><span> </span><span class="annot"><span class="annottext">Var
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsBind (GhcPass 'Typechecked)
forall (p :: Pass).
IdP (GhcPass p) -&gt; LHsExpr (GhcPass p) -&gt; LHsBind (GhcPass p)
</span><a href="GHC.Hs.Utils.html#mkVarBind"><span class="hs-identifier hs-var">mkVarBind</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Var, LHsExpr (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681106352"><span class="hs-identifier hs-var">rep_binds</span></a></span><span>
</span><span id="line-516"></span><span>        </span><span id="local-6989586621681106342"><span class="annot"><span class="annottext">tcg_env' :: TcGblEnv
</span><a href="#local-6989586621681106342"><span class="hs-identifier hs-var hs-var">tcg_env'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106345"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [LHsBinds (GhcPass 'Typechecked)] -&gt; TcGblEnv
</span><a href="GHC.Tc.Utils.Env.html#addTypecheckedBinds"><span class="hs-operator hs-var">`addTypecheckedBinds`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Typechecked)] -&gt; LHsBinds (GhcPass 'Typechecked)
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681106344"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-517"></span><span>    </span><span class="annot"><span class="annottext">(TcGblEnv, a) -&gt; TcRn (TcGblEnv, a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681106342"><span class="hs-identifier hs-var">tcg_env'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681106355"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-518"></span><span>
</span><span id="line-519"></span><span class="hs-comment">-- | Produce or find a 'KindRep' for the given kind.</span><span>
</span><span id="line-520"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#getKindRep"><span class="hs-identifier hs-type">getKindRep</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableStuff"><span class="hs-identifier hs-type">TypeableStuff</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Map.html#CmEnv"><span class="hs-identifier hs-type">CmEnv</span></a></span><span>  </span><span class="hs-comment">-- ^ in-scope kind variables</span><span>
</span><span id="line-521"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span>   </span><span class="hs-comment">-- ^ the kind we want a 'KindRep' for</span><span>
</span><span id="line-522"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-523"></span><span id="getKindRep"><span class="annot"><span class="annottext">getKindRep :: TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#getKindRep"><span class="hs-identifier hs-var hs-var">getKindRep</span></a></span></span><span> </span><span id="local-6989586621681106340"><span class="annot"><span class="annottext">stuff :: TypeableStuff
</span><a href="#local-6989586621681106340"><span class="hs-identifier hs-var">stuff</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#Stuff"><span class="hs-identifier hs-type">Stuff</span></a></span><span> </span><span class="hs-special">{</span><span id="local-6989586621681106328"><span id="local-6989586621681106329"><span id="local-6989586621681106330"><span id="local-6989586621681106331"><span id="local-6989586621681106332"><span id="local-6989586621681106333"><span id="local-6989586621681106334"><span id="local-6989586621681106335"><span id="local-6989586621681106336"><span id="local-6989586621681106337"><span id="local-6989586621681106338"><span id="local-6989586621681106339"><span class="annot"><span class="annottext">Platform
TyCon
DataCon
FastString -&gt; LHsExpr (GhcPass 'Typechecked)
typeLitNatDataCon :: DataCon
typeLitSymbolDataCon :: DataCon
kindRepTypeLitSDataCon :: DataCon
kindRepTYPEDataCon :: DataCon
kindRepFunDataCon :: DataCon
kindRepAppDataCon :: DataCon
kindRepVarDataCon :: DataCon
kindRepTyConAppDataCon :: DataCon
kindRepTyCon :: TyCon
trNameLit :: FastString -&gt; LHsExpr (GhcPass 'Typechecked)
trTyConDataCon :: DataCon
platform :: Platform
typeLitNatDataCon :: TypeableStuff -&gt; DataCon
typeLitSymbolDataCon :: TypeableStuff -&gt; DataCon
kindRepTypeLitSDataCon :: TypeableStuff -&gt; DataCon
kindRepTYPEDataCon :: TypeableStuff -&gt; DataCon
kindRepFunDataCon :: TypeableStuff -&gt; DataCon
kindRepAppDataCon :: TypeableStuff -&gt; DataCon
kindRepVarDataCon :: TypeableStuff -&gt; DataCon
kindRepTyConAppDataCon :: TypeableStuff -&gt; DataCon
kindRepTyCon :: TypeableStuff -&gt; TyCon
trNameLit :: TypeableStuff -&gt; FastString -&gt; LHsExpr (GhcPass 'Typechecked)
trTyConDataCon :: TypeableStuff -&gt; DataCon
platform :: TypeableStuff -&gt; Platform
</span><a href="#local-6989586621681106328"><span class="hs-glyph hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">..</span></a></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681106327"><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106327"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681106326"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-524"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-525"></span><span>    </span><span class="annot"><a href="#local-6989586621681106326"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-526"></span><span>    </span><span id="local-6989586621681106326"><span class="annot"><span class="annottext">go :: Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681106326"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a. StateT KindRepEnv TcRn a -&gt; KindRepM a
</span><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-var">KindRepM</span></a></span><span> </span><span class="annot"><span class="annottext">(StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
 -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; (Kind
    -&gt; StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked)))
-&gt; Kind
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(KindRepEnv
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv)
      (LHsExpr (GhcPass 'Typechecked), KindRepEnv))
-&gt; StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
forall s (m :: * -&gt; *) a. (s -&gt; m (a, s)) -&gt; StateT s m a
</span><a href="../../transformers/src/Control.Monad.Trans.State.Lazy.html#StateT"><span class="hs-identifier hs-var">StateT</span></a></span><span> </span><span class="annot"><span class="annottext">((KindRepEnv
  -&gt; IOEnv
       (Env TcGblEnv TcLclEnv)
       (LHsExpr (GhcPass 'Typechecked), KindRepEnv))
 -&gt; StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked)))
-&gt; (Kind
    -&gt; KindRepEnv
    -&gt; IOEnv
         (Env TcGblEnv TcLclEnv)
         (LHsExpr (GhcPass 'Typechecked), KindRepEnv))
-&gt; Kind
-&gt; StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
-&gt; KindRepEnv
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (LHsExpr (GhcPass 'Typechecked), KindRepEnv)
</span><a href="#local-6989586621681106324"><span class="hs-identifier hs-var">go'</span></a></span><span>
</span><span id="line-527"></span><span>
</span><span id="line-528"></span><span>    </span><span class="annot"><a href="#local-6989586621681106324"><span class="hs-identifier hs-type">go'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepEnv"><span class="hs-identifier hs-type">KindRepEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcRn"><span class="hs-identifier hs-type">TcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepEnv"><span class="hs-identifier hs-type">KindRepEnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-529"></span><span>    </span><span id="local-6989586621681106324"><span class="annot"><span class="annottext">go' :: Kind
-&gt; KindRepEnv
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (LHsExpr (GhcPass 'Typechecked), KindRepEnv)
</span><a href="#local-6989586621681106324"><span class="hs-identifier hs-var hs-var">go'</span></a></span></span><span> </span><span id="local-6989586621681106323"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106323"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621681106322"><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106322"><span class="hs-identifier hs-var">env</span></a></span></span><span>
</span><span id="line-530"></span><span>        </span><span class="hs-comment">-- Look through type synonyms</span><span>
</span><span id="line-531"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681106321"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106321"><span class="hs-identifier hs-var">k'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Maybe Kind
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106323"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind
-&gt; KindRepEnv
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (LHsExpr (GhcPass 'Typechecked), KindRepEnv)
</span><a href="#local-6989586621681106324"><span class="hs-identifier hs-var">go'</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106321"><span class="hs-identifier hs-var">k'</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106322"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-532"></span><span>
</span><span id="line-533"></span><span>        </span><span class="hs-comment">-- We've already generated the needed KindRep</span><span>
</span><span id="line-534"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106319"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106319"><span class="hs-identifier hs-var">id</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (LHsExpr (GhcPass 'Typechecked))
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">KindRepEnv
-&gt; CmEnv
-&gt; Kind
-&gt; Maybe (Var, Maybe (LHsExpr (GhcPass 'Typechecked)))
forall a. TypeMap a -&gt; CmEnv -&gt; Kind -&gt; Maybe a
</span><a href="GHC.Core.Map.html#lookupTypeMapWithScope"><span class="hs-identifier hs-var">lookupTypeMapWithScope</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106322"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106327"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106323"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-535"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked), KindRepEnv)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (LHsExpr (GhcPass 'Typechecked), KindRepEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106319"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106322"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-536"></span><span>
</span><span id="line-537"></span><span>        </span><span class="hs-comment">-- We need to construct a new KindRep binding</span><span>
</span><span id="line-538"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-539"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-comment">-- Place a NOINLINE pragma on KindReps since they tend to be quite</span><span>
</span><span id="line-540"></span><span>           </span><span class="hs-comment">-- large and bloat interface files.</span><span>
</span><span id="line-541"></span><span>           </span><span id="local-6989586621681106317"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106317"><span class="hs-identifier hs-var">rep_bndr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; InlinePragma -&gt; Var
</span><a href="GHC.Types.Id.html#setInlinePragma"><span class="hs-operator hs-var">`setInlinePragma`</span></a></span><span> </span><span class="annot"><span class="annottext">InlinePragma
</span><a href="GHC.Types.Basic.html#neverInlinePragma"><span class="hs-identifier hs-var">neverInlinePragma</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-542"></span><span>                   </span><span class="annot"><span class="annottext">(Var -&gt; Var) -&gt; TcM Var -&gt; TcM Var
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Kind -&gt; Kind -&gt; TcM Var
forall gbl lcl. FastString -&gt; Kind -&gt; Kind -&gt; TcRnIf gbl lcl Var
</span><a href="GHC.Tc.Utils.Monad.html#newSysLocalId"><span class="hs-identifier hs-var">newSysLocalId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;$krep&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Kind
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106336"><span class="hs-identifier hs-var">kindRepTyCon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-543"></span><span>
</span><span id="line-544"></span><span>           </span><span class="hs-comment">-- do we need to tie a knot here?</span><span>
</span><span id="line-545"></span><span>           </span><span class="annot"><span class="annottext">(StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
 -&gt; KindRepEnv
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv)
      (LHsExpr (GhcPass 'Typechecked), KindRepEnv))
-&gt; KindRepEnv
-&gt; StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (LHsExpr (GhcPass 'Typechecked), KindRepEnv)
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#flip"><span class="hs-identifier hs-var">flip</span></a></span><span> </span><span class="annot"><span class="annottext">StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
-&gt; KindRepEnv
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (LHsExpr (GhcPass 'Typechecked), KindRepEnv)
forall s (m :: * -&gt; *) a. StateT s m a -&gt; s -&gt; m (a, s)
</span><a href="../../transformers/src/Control.Monad.Trans.State.Lazy.html#runStateT"><span class="hs-identifier hs-var hs-var">runStateT</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepEnv
</span><a href="#local-6989586621681106322"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">(StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv)
      (LHsExpr (GhcPass 'Typechecked), KindRepEnv))
-&gt; StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (LHsExpr (GhcPass 'Typechecked), KindRepEnv)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">KindRepM (LHsExpr (GhcPass 'Typechecked))
-&gt; StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
forall a. KindRepM a -&gt; StateT KindRepEnv TcRn a
</span><a href="GHC.Tc.Instance.Typeable.html#unKindRepM"><span class="hs-identifier hs-var hs-var">unKindRepM</span></a></span><span> </span><span class="annot"><span class="annottext">(KindRepM (LHsExpr (GhcPass 'Typechecked))
 -&gt; StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked)))
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
-&gt; StateT KindRepEnv TcRn (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-546"></span><span>               </span><span id="local-6989586621681106312"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106312"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkKindRepRhs"><span class="hs-identifier hs-var">mkKindRepRhs</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106340"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106327"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106323"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-547"></span><span>               </span><span class="annot"><span class="annottext">CmEnv
-&gt; Kind -&gt; Var -&gt; LHsExpr (GhcPass 'Typechecked) -&gt; KindRepM ()
</span><a href="GHC.Tc.Instance.Typeable.html#addKindRepBind"><span class="hs-identifier hs-var">addKindRepBind</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106327"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106323"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106317"><span class="hs-identifier hs-var">rep_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106312"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-548"></span><span>               </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106317"><span class="hs-identifier hs-var">rep_bndr</span></a></span><span>
</span><span id="line-549"></span><span>
</span><span id="line-550"></span><span class="hs-comment">-- | Construct the right-hand-side of the 'KindRep' for the given 'Kind' and</span><span>
</span><span id="line-551"></span><span class="hs-comment">-- in-scope kind variable set.</span><span>
</span><span id="line-552"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkKindRepRhs"><span class="hs-identifier hs-type">mkKindRepRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableStuff"><span class="hs-identifier hs-type">TypeableStuff</span></a></span><span>
</span><span id="line-553"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Map.html#CmEnv"><span class="hs-identifier hs-type">CmEnv</span></a></span><span>       </span><span class="hs-comment">-- ^ in-scope kind variables</span><span>
</span><span id="line-554"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span>        </span><span class="hs-comment">-- ^ the kind we want a 'KindRep' for</span><span>
</span><span id="line-555"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#KindRepM"><span class="hs-identifier hs-type">KindRepM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ RHS expression</span><span>
</span><span id="line-556"></span><span id="mkKindRepRhs"><span class="annot"><span class="annottext">mkKindRepRhs :: TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#mkKindRepRhs"><span class="hs-identifier hs-var hs-var">mkKindRepRhs</span></a></span></span><span> </span><span id="local-6989586621681106311"><span class="annot"><span class="annottext">stuff :: TypeableStuff
</span><a href="#local-6989586621681106311"><span class="hs-identifier hs-var">stuff</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#Stuff"><span class="hs-identifier hs-type">Stuff</span></a></span><span> </span><span class="hs-special">{</span><span id="local-6989586621681106299"><span id="local-6989586621681106300"><span id="local-6989586621681106301"><span id="local-6989586621681106302"><span id="local-6989586621681106303"><span id="local-6989586621681106304"><span id="local-6989586621681106305"><span id="local-6989586621681106306"><span id="local-6989586621681106307"><span id="local-6989586621681106308"><span id="local-6989586621681106309"><span id="local-6989586621681106310"><span class="annot"><span class="annottext">Platform
TyCon
DataCon
FastString -&gt; LHsExpr (GhcPass 'Typechecked)
typeLitNatDataCon :: DataCon
typeLitSymbolDataCon :: DataCon
kindRepTypeLitSDataCon :: DataCon
kindRepTYPEDataCon :: DataCon
kindRepFunDataCon :: DataCon
kindRepAppDataCon :: DataCon
kindRepVarDataCon :: DataCon
kindRepTyConAppDataCon :: DataCon
kindRepTyCon :: TyCon
trNameLit :: FastString -&gt; LHsExpr (GhcPass 'Typechecked)
trTyConDataCon :: DataCon
platform :: Platform
typeLitNatDataCon :: TypeableStuff -&gt; DataCon
typeLitSymbolDataCon :: TypeableStuff -&gt; DataCon
kindRepTypeLitSDataCon :: TypeableStuff -&gt; DataCon
kindRepTYPEDataCon :: TypeableStuff -&gt; DataCon
kindRepFunDataCon :: TypeableStuff -&gt; DataCon
kindRepAppDataCon :: TypeableStuff -&gt; DataCon
kindRepVarDataCon :: TypeableStuff -&gt; DataCon
kindRepTyConAppDataCon :: TypeableStuff -&gt; DataCon
kindRepTyCon :: TypeableStuff -&gt; TyCon
trNameLit :: TypeableStuff -&gt; FastString -&gt; LHsExpr (GhcPass 'Typechecked)
trTyConDataCon :: TypeableStuff -&gt; DataCon
platform :: TypeableStuff -&gt; Platform
</span><a href="#local-6989586621681106299"><span class="hs-glyph hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">..</span></a></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681106298"><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106298"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span>
</span><span id="line-557"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-558"></span><span>    </span><span id="local-6989586621681106297"><span class="annot"><span class="annottext">new_kind_rep :: Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681106297"><span class="hs-identifier hs-var hs-var">new_kind_rep</span></a></span></span><span> </span><span id="local-6989586621681106296"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106296"><span class="hs-identifier hs-var">k</span></a></span></span><span>
</span><span id="line-559"></span><span>        </span><span class="hs-comment">-- We handle (TYPE LiftedRep) etc separately to make it</span><span>
</span><span id="line-560"></span><span>        </span><span class="hs-comment">-- clear to consumers (e.g. serializers) that there is</span><span>
</span><span id="line-561"></span><span>        </span><span class="hs-comment">-- a loop here (as TYPE :: RuntimeRep -&gt; TYPE 'LiftedRep)</span><span>
</span><span id="line-562"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Core.Type.html#tcIsConstraintKind"><span class="hs-identifier hs-var">tcIsConstraintKind</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106296"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-563"></span><span>              </span><span class="hs-comment">-- Typeable respects the Constraint/Type distinction</span><span>
</span><span id="line-564"></span><span>              </span><span class="hs-comment">-- so do not follow the special case here</span><span>
</span><span id="line-565"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681106294"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106294"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Kind -&gt; Maybe Kind
Kind -&gt; Maybe Kind
</span><a href="GHC.Core.Type.html#kindRep_maybe"><span class="hs-identifier hs-var">kindRep_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106296"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-566"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681106292"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106292"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Kind -&gt; Maybe (TyCon, [Kind])
Kind -&gt; Maybe (TyCon, [Kind])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106294"><span class="hs-identifier hs-var">arg</span></a></span><span>
</span><span id="line-567"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681106290"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106290"><span class="hs-identifier hs-var">dc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe DataCon
</span><a href="GHC.Core.TyCon.html#isPromotedDataCon_maybe"><span class="hs-identifier hs-var">isPromotedDataCon_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106292"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-568"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106302"><span class="hs-identifier hs-var">kindRepTYPEDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106290"><span class="hs-identifier hs-var">dc</span></a></span><span>
</span><span id="line-569"></span><span>
</span><span id="line-570"></span><span>    </span><span class="annot"><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621681106288"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106288"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-571"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681106287"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681106287"><span class="hs-identifier hs-var">idx</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CmEnv -&gt; Var -&gt; Maybe Int
</span><a href="GHC.Core.Map.html#lookupCME"><span class="hs-identifier hs-var">lookupCME</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106298"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106288"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-572"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106305"><span class="hs-identifier hs-var">kindRepVarDataCon</span></a></span><span>
</span><span id="line-573"></span><span>                 </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; LHsExpr (GhcPass 'Typechecked)
forall (p :: Pass). Integer -&gt; LHsExpr (GhcPass p)
</span><a href="GHC.Hs.Utils.html#nlHsIntLit"><span class="hs-identifier hs-var">nlHsIntLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681106287"><span class="hs-identifier hs-var">idx</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-574"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-575"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkTyConKindRepBinds.go(tyvar)&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106288"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-576"></span><span>
</span><span id="line-577"></span><span>    </span><span class="annot"><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621681106284"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106284"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621681106283"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106283"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-578"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681106282"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106282"><span class="hs-identifier hs-var">rep1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#getKindRep"><span class="hs-identifier hs-var">getKindRep</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106311"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106298"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106284"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-579"></span><span>           </span><span id="local-6989586621681106281"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106281"><span class="hs-identifier hs-var">rep2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#getKindRep"><span class="hs-identifier hs-var">getKindRep</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106311"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106298"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106283"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-580"></span><span>           </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106304"><span class="hs-identifier hs-var">kindRepAppDataCon</span></a></span><span>
</span><span id="line-581"></span><span>                    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106282"><span class="hs-identifier hs-var">rep1</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106281"><span class="hs-identifier hs-var">rep2</span></a></span><span>
</span><span id="line-582"></span><span>
</span><span id="line-583"></span><span>    </span><span class="annot"><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span> </span><span id="local-6989586621681106280"><span class="annot"><span class="annottext">k :: Kind
</span><a href="#local-6989586621681106280"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621681106279"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106279"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621681106278"><span class="annot"><span class="annottext">[Kind]
</span><a href="#local-6989586621681106278"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-584"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681106277"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106277"><span class="hs-identifier hs-var">rep_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe Name
</span><a href="GHC.Core.TyCon.html#tyConRepName_maybe"><span class="hs-identifier hs-var">tyConRepName_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106279"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-585"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681106276"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106276"><span class="hs-identifier hs-var">rep_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM Var -&gt; KindRepM Var
forall a. TcRn a -&gt; KindRepM a
</span><a href="GHC.Tc.Instance.Typeable.html#liftTc"><span class="hs-identifier hs-var">liftTc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM Var -&gt; KindRepM Var) -&gt; TcM Var -&gt; KindRepM Var
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM Var
forall (m :: * -&gt; *). MonadThings m =&gt; Name -&gt; m Var
</span><a href="GHC.Driver.Types.html#lookupId"><span class="hs-identifier hs-var">lookupId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681106277"><span class="hs-identifier hs-var">rep_name</span></a></span><span>
</span><span id="line-586"></span><span>           </span><span id="local-6989586621681106275"><span class="annot"><span class="annottext">[LHsExpr (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681106275"><span class="hs-identifier hs-var">tys'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; [Kind] -&gt; KindRepM [LHsExpr (GhcPass 'Typechecked)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#getKindRep"><span class="hs-identifier hs-var">getKindRep</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106311"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106298"><span class="hs-identifier hs-var">in_scope</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Kind]
</span><a href="#local-6989586621681106278"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-587"></span><span>           </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106306"><span class="hs-identifier hs-var">kindRepTyConAppDataCon</span></a></span><span>
</span><span id="line-588"></span><span>                    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106276"><span class="hs-identifier hs-var">rep_id</span></a></span><span>
</span><span id="line-589"></span><span>                    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
-&gt; [LHsExpr (GhcPass 'Typechecked)]
-&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#mkList"><span class="hs-identifier hs-var">mkList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Kind
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106307"><span class="hs-identifier hs-var">kindRepTyCon</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LHsExpr (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681106275"><span class="hs-identifier hs-var">tys'</span></a></span><span>
</span><span id="line-590"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-591"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkTyConKindRepBinds(TyConApp)&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106279"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106280"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-592"></span><span>
</span><span id="line-593"></span><span>    </span><span class="annot"><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Bndr"><span class="hs-identifier hs-type">Bndr</span></a></span><span> </span><span id="local-6989586621681106272"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106272"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgFlag
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681106271"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106271"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-594"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkTyConKindRepBinds(ForAllTy)&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621681106272"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106271"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-595"></span><span>
</span><span id="line-596"></span><span>    </span><span class="annot"><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Kind
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681106270"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106270"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621681106269"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106269"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-597"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681106268"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106268"><span class="hs-identifier hs-var">rep1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#getKindRep"><span class="hs-identifier hs-var">getKindRep</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106311"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106298"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106270"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-598"></span><span>           </span><span id="local-6989586621681106267"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106267"><span class="hs-identifier hs-var">rep2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TypeableStuff
-&gt; CmEnv -&gt; Kind -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Instance.Typeable.html#getKindRep"><span class="hs-identifier hs-var">getKindRep</span></a></span><span> </span><span class="annot"><span class="annottext">TypeableStuff
</span><a href="#local-6989586621681106311"><span class="hs-identifier hs-var">stuff</span></a></span><span> </span><span class="annot"><span class="annottext">CmEnv
</span><a href="#local-6989586621681106298"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106269"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-599"></span><span>           </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106303"><span class="hs-identifier hs-var">kindRepFunDataCon</span></a></span><span>
</span><span id="line-600"></span><span>                    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106268"><span class="hs-identifier hs-var">rep1</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106267"><span class="hs-identifier hs-var">rep2</span></a></span><span>
</span><span id="line-601"></span><span>
</span><span id="line-602"></span><span>    </span><span class="annot"><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#NumTyLit"><span class="hs-identifier hs-type">NumTyLit</span></a></span><span> </span><span id="local-6989586621681106265"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621681106265"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-603"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106301"><span class="hs-identifier hs-var">kindRepTypeLitSDataCon</span></a></span><span>
</span><span id="line-604"></span><span>                 </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106299"><span class="hs-identifier hs-var">typeLitNatDataCon</span></a></span><span>
</span><span id="line-605"></span><span>                 </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">HsLit (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (p :: Pass). HsLit (GhcPass p) -&gt; LHsExpr (GhcPass p)
</span><a href="GHC.Hs.Utils.html#nlHsLit"><span class="hs-identifier hs-var">nlHsLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; HsLit (GhcPass 'Typechecked)
forall (p :: Pass). FastString -&gt; HsLit (GhcPass p)
</span><a href="GHC.Hs.Utils.html#mkHsStringPrimLit"><span class="hs-identifier hs-var">mkHsStringPrimLit</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; HsLit (GhcPass 'Typechecked))
-&gt; FastString -&gt; HsLit (GhcPass 'Typechecked)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; FastString) -&gt; String -&gt; FastString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621681106265"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-606"></span><span>
</span><span id="line-607"></span><span>    </span><span class="annot"><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#StrTyLit"><span class="hs-identifier hs-type">StrTyLit</span></a></span><span> </span><span id="local-6989586621681106262"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681106262"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-608"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked)))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106301"><span class="hs-identifier hs-var">kindRepTypeLitSDataCon</span></a></span><span>
</span><span id="line-609"></span><span>                 </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106300"><span class="hs-identifier hs-var">typeLitSymbolDataCon</span></a></span><span>
</span><span id="line-610"></span><span>                 </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">HsLit (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (p :: Pass). HsLit (GhcPass p) -&gt; LHsExpr (GhcPass p)
</span><a href="GHC.Hs.Utils.html#nlHsLit"><span class="hs-identifier hs-var">nlHsLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; HsLit (GhcPass 'Typechecked)
forall (p :: Pass). FastString -&gt; HsLit (GhcPass p)
</span><a href="GHC.Hs.Utils.html#mkHsStringPrimLit"><span class="hs-identifier hs-var">mkHsStringPrimLit</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; HsLit (GhcPass 'Typechecked))
-&gt; FastString -&gt; HsLit (GhcPass 'Typechecked)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; FastString) -&gt; String -&gt; FastString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681106262"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-611"></span><span>
</span><span id="line-612"></span><span>    </span><span class="hs-comment">-- See Note [Typeable instances for casted types]</span><span>
</span><span id="line-613"></span><span>    </span><span class="annot"><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621681106261"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106261"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621681106260"><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621681106260"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-614"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkTyConKindRepBinds.go(cast)&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106261"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">KindCoercion -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621681106260"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-615"></span><span>
</span><span id="line-616"></span><span>    </span><span class="annot"><a href="#local-6989586621681106297"><span class="hs-identifier hs-var">new_kind_rep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span id="local-6989586621681106259"><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621681106259"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-617"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; KindRepM (LHsExpr (GhcPass 'Typechecked))
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkTyConKindRepBinds.go(coercion)&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">KindCoercion -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621681106259"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-618"></span><span>
</span><span id="line-619"></span><span class="hs-comment">-- | Produce the right-hand-side of a @TyCon@ representation.</span><span>
</span><span id="line-620"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkTyConRepTyConRHS"><span class="hs-identifier hs-type">mkTyConRepTyConRHS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeableStuff"><span class="hs-identifier hs-type">TypeableStuff</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#TypeRepTodo"><span class="hs-identifier hs-type">TypeRepTodo</span></a></span><span>
</span><span id="line-621"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>      </span><span class="hs-comment">-- ^ the 'TyCon' we are producing a binding for</span><span>
</span><span id="line-622"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-comment">-- ^ its 'KindRep'</span><span>
</span><span id="line-623"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-624"></span><span id="mkTyConRepTyConRHS"><span class="annot"><span class="annottext">mkTyConRepTyConRHS :: TypeableStuff
-&gt; TypeRepTodo
-&gt; TyCon
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#mkTyConRepTyConRHS"><span class="hs-identifier hs-var hs-var">mkTyConRepTyConRHS</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#Stuff"><span class="hs-identifier hs-type">Stuff</span></a></span><span> </span><span class="hs-special">{</span><span id="local-6989586621681106247"><span id="local-6989586621681106248"><span id="local-6989586621681106249"><span id="local-6989586621681106250"><span id="local-6989586621681106251"><span id="local-6989586621681106252"><span id="local-6989586621681106253"><span id="local-6989586621681106254"><span id="local-6989586621681106255"><span id="local-6989586621681106256"><span id="local-6989586621681106257"><span id="local-6989586621681106258"><span class="annot"><span class="annottext">Platform
TyCon
DataCon
FastString -&gt; LHsExpr (GhcPass 'Typechecked)
typeLitNatDataCon :: DataCon
typeLitSymbolDataCon :: DataCon
kindRepTypeLitSDataCon :: DataCon
kindRepTYPEDataCon :: DataCon
kindRepFunDataCon :: DataCon
kindRepAppDataCon :: DataCon
kindRepVarDataCon :: DataCon
kindRepTyConAppDataCon :: DataCon
kindRepTyCon :: TyCon
trNameLit :: FastString -&gt; LHsExpr (GhcPass 'Typechecked)
trTyConDataCon :: DataCon
platform :: Platform
typeLitNatDataCon :: TypeableStuff -&gt; DataCon
typeLitSymbolDataCon :: TypeableStuff -&gt; DataCon
kindRepTypeLitSDataCon :: TypeableStuff -&gt; DataCon
kindRepTYPEDataCon :: TypeableStuff -&gt; DataCon
kindRepFunDataCon :: TypeableStuff -&gt; DataCon
kindRepAppDataCon :: TypeableStuff -&gt; DataCon
kindRepVarDataCon :: TypeableStuff -&gt; DataCon
kindRepTyConAppDataCon :: TypeableStuff -&gt; DataCon
kindRepTyCon :: TypeableStuff -&gt; TyCon
trNameLit :: TypeableStuff -&gt; FastString -&gt; LHsExpr (GhcPass 'Typechecked)
trTyConDataCon :: TypeableStuff -&gt; DataCon
platform :: TypeableStuff -&gt; Platform
</span><a href="#local-6989586621681106247"><span class="hs-glyph hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">..</span></a></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681106246"><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106246"><span class="hs-identifier hs-var">todo</span></a></span></span><span> </span><span id="local-6989586621681106245"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106245"><span class="hs-identifier hs-var">tycon</span></a></span></span><span> </span><span id="local-6989586621681106244"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106244"><span class="hs-identifier hs-var">kind_rep</span></a></span></span><span>
</span><span id="line-625"></span><span>  </span><span class="hs-glyph">=</span><span>           </span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681106257"><span class="hs-identifier hs-var">trTyConDataCon</span></a></span><span>
</span><span id="line-626"></span><span>    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">HsLit (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (p :: Pass). HsLit (GhcPass p) -&gt; LHsExpr (GhcPass p)
</span><a href="GHC.Hs.Utils.html#nlHsLit"><span class="hs-identifier hs-var">nlHsLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Word64 -&gt; HsLit (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#word64"><span class="hs-identifier hs-var">word64</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681106258"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621681106242"><span class="hs-identifier hs-var">high</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-627"></span><span>    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">HsLit (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (p :: Pass). HsLit (GhcPass p) -&gt; LHsExpr (GhcPass p)
</span><a href="GHC.Hs.Utils.html#nlHsLit"><span class="hs-identifier hs-var">nlHsLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Word64 -&gt; HsLit (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#word64"><span class="hs-identifier hs-var">word64</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681106258"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621681106241"><span class="hs-identifier hs-var">low</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-628"></span><span>    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#mod_rep_expr"><span class="hs-identifier hs-var hs-var">mod_rep_expr</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106246"><span class="hs-identifier hs-var">todo</span></a></span><span>
</span><span id="line-629"></span><span>    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106256"><span class="hs-identifier hs-var">trNameLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681106240"><span class="hs-identifier hs-var">tycon_str</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-630"></span><span>    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">HsLit (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (p :: Pass). HsLit (GhcPass p) -&gt; LHsExpr (GhcPass p)
</span><a href="GHC.Hs.Utils.html#nlHsLit"><span class="hs-identifier hs-var">nlHsLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; HsLit (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106239"><span class="hs-identifier hs-var">int</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681106238"><span class="hs-identifier hs-var">n_kind_vars</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-631"></span><span>    </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106244"><span class="hs-identifier hs-var">kind_rep</span></a></span><span>
</span><span id="line-632"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-633"></span><span>    </span><span id="local-6989586621681106238"><span class="annot"><span class="annottext">n_kind_vars :: Int
</span><a href="#local-6989586621681106238"><span class="hs-identifier hs-var hs-var">n_kind_vars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyConBinder] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">([TyConBinder] -&gt; Int) -&gt; [TyConBinder] -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(TyConBinder -&gt; Bool) -&gt; [TyConBinder] -&gt; [TyConBinder]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">TyConBinder -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isNamedTyConBinder"><span class="hs-identifier hs-var">isNamedTyConBinder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [TyConBinder]
</span><a href="GHC.Core.TyCon.html#tyConBinders"><span class="hs-identifier hs-var hs-var">tyConBinders</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106245"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-634"></span><span>    </span><span id="local-6989586621681106240"><span class="annot"><span class="annottext">tycon_str :: String
</span><a href="#local-6989586621681106240"><span class="hs-identifier hs-var hs-var">tycon_str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="#local-6989586621681106234"><span class="hs-identifier hs-var">add_tick</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccName -&gt; String
</span><a href="GHC.Types.Name.Occurrence.html#occNameString"><span class="hs-identifier hs-var">occNameString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; OccName
forall a. NamedThing a =&gt; a -&gt; OccName
</span><a href="GHC.Types.Name.html#getOccName"><span class="hs-identifier hs-var">getOccName</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106245"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-635"></span><span>    </span><span id="local-6989586621681106234"><span class="annot"><span class="annottext">add_tick :: String -&gt; String
</span><a href="#local-6989586621681106234"><span class="hs-identifier hs-var hs-var">add_tick</span></a></span></span><span> </span><span id="local-6989586621681106231"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681106231"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isPromotedDataCon"><span class="hs-identifier hs-var">isPromotedDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681106245"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\''</span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681106231"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-636"></span><span>               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681106231"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-637"></span><span>
</span><span id="line-638"></span><span>    </span><span class="hs-comment">-- This must match the computation done in</span><span>
</span><span id="line-639"></span><span>    </span><span class="hs-comment">-- Data.Typeable.Internal.mkTyConFingerprint.</span><span>
</span><span id="line-640"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Fingerprint.Type.html#Fingerprint"><span class="hs-identifier hs-type">Fingerprint</span></a></span><span> </span><span id="local-6989586621681106242"><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621681106242"><span class="hs-identifier hs-var">high</span></a></span></span><span> </span><span id="local-6989586621681106241"><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621681106241"><span class="hs-identifier hs-var">low</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Fingerprint] -&gt; Fingerprint
</span><a href="../../base/src/GHC.Fingerprint.html#fingerprintFingerprints"><span class="hs-identifier hs-var">fingerprintFingerprints</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TypeRepTodo -&gt; Fingerprint
</span><a href="GHC.Tc.Instance.Typeable.html#pkg_fingerprint"><span class="hs-identifier hs-var hs-var">pkg_fingerprint</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106246"><span class="hs-identifier hs-var">todo</span></a></span><span>
</span><span id="line-641"></span><span>                                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TypeRepTodo -&gt; Fingerprint
</span><a href="GHC.Tc.Instance.Typeable.html#mod_fingerprint"><span class="hs-identifier hs-var hs-var">mod_fingerprint</span></a></span><span> </span><span class="annot"><span class="annottext">TypeRepTodo
</span><a href="#local-6989586621681106246"><span class="hs-identifier hs-var">todo</span></a></span><span>
</span><span id="line-642"></span><span>                                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Fingerprint
</span><a href="../../base/src/GHC.Fingerprint.html#fingerprintString"><span class="hs-identifier hs-var">fingerprintString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681106240"><span class="hs-identifier hs-var">tycon_str</span></a></span><span>
</span><span id="line-643"></span><span>                                                   </span><span class="hs-special">]</span><span>
</span><span id="line-644"></span><span>
</span><span id="line-645"></span><span>    </span><span class="annot"><a href="#local-6989586621681106239"><span class="hs-identifier hs-type">int</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Lit.html#HsLit"><span class="hs-identifier hs-type">HsLit</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-646"></span><span>    </span><span id="local-6989586621681106239"><span class="annot"><span class="annottext">int :: Int -&gt; HsLit (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106239"><span class="hs-identifier hs-var hs-var">int</span></a></span></span><span> </span><span id="local-6989586621681106229"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681106229"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XHsIntPrim (GhcPass 'Typechecked)
-&gt; Integer -&gt; HsLit (GhcPass 'Typechecked)
forall x. XHsIntPrim x -&gt; Integer -&gt; HsLit x
</span><a href="GHC.Hs.Lit.html#HsIntPrim"><span class="hs-identifier hs-var">HsIntPrim</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SourceText
</span><a href="GHC.Types.Basic.html#SourceText"><span class="hs-identifier hs-var">SourceText</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; SourceText) -&gt; String -&gt; SourceText
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681106229"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681106229"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-647"></span><span>
</span><span id="line-648"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#word64"><span class="hs-identifier hs-type">word64</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word64"><span class="hs-identifier hs-type">Word64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Lit.html#HsLit"><span class="hs-identifier hs-type">HsLit</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-649"></span><span id="word64"><span class="annot"><span class="annottext">word64 :: Platform -&gt; Word64 -&gt; HsLit (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#word64"><span class="hs-identifier hs-var hs-var">word64</span></a></span></span><span> </span><span id="local-6989586621681106226"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681106226"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span id="local-6989586621681106225"><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621681106225"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Platform -&gt; PlatformWordSize
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformWordSize"><span class="hs-identifier hs-var hs-var">platformWordSize</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681106226"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-650"></span><span>   </span><span class="annot"><span class="annottext">PlatformWordSize
</span><a href="../../ghc-boot/src/GHC.Platform.html#PW4"><span class="hs-identifier hs-var">PW4</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">XHsWord64Prim (GhcPass 'Typechecked)
-&gt; Integer -&gt; HsLit (GhcPass 'Typechecked)
forall x. XHsWord64Prim x -&gt; Integer -&gt; HsLit x
</span><a href="GHC.Hs.Lit.html#HsWord64Prim"><span class="hs-identifier hs-var">HsWord64Prim</span></a></span><span> </span><span class="annot"><span class="annottext">SourceText
XHsWord64Prim (GhcPass 'Typechecked)
</span><a href="GHC.Types.Basic.html#NoSourceText"><span class="hs-identifier hs-var">NoSourceText</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word64 -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621681106225"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-651"></span><span>   </span><span class="annot"><span class="annottext">PlatformWordSize
</span><a href="../../ghc-boot/src/GHC.Platform.html#PW8"><span class="hs-identifier hs-var">PW8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">XHsWordPrim (GhcPass 'Typechecked)
-&gt; Integer -&gt; HsLit (GhcPass 'Typechecked)
forall x. XHsWordPrim x -&gt; Integer -&gt; HsLit x
</span><a href="GHC.Hs.Lit.html#HsWordPrim"><span class="hs-identifier hs-var">HsWordPrim</span></a></span><span>   </span><span class="annot"><span class="annottext">SourceText
XHsWordPrim (GhcPass 'Typechecked)
</span><a href="GHC.Types.Basic.html#NoSourceText"><span class="hs-identifier hs-var">NoSourceText</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word64 -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Word64
</span><a href="#local-6989586621681106225"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-652"></span><span>
</span><span id="line-653"></span><span class="hs-comment">{-
Note [Representing TyCon kinds: KindRep]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
One of the operations supported by Typeable is typeRepKind,

    typeRepKind :: TypeRep (a :: k) -&gt; TypeRep k

Implementing this is a bit tricky for poly-kinded types like

    data Proxy (a :: k) :: Type
    -- Proxy :: forall k. k -&gt; Type

The TypeRep encoding of `Proxy Type Int` looks like this:

    $tcProxy :: GHC.Types.TyCon
    $trInt   :: TypeRep Int
    TrType   :: TypeRep Type

    $trProxyType :: TypeRep (Proxy Type :: Type -&gt; Type)
    $trProxyType = TrTyCon $tcProxy
                           [TrType]  -- kind variable instantiation
                           (tyConKind $tcProxy [TrType]) -- The TypeRep of
                                                         -- Type -&gt; Type

    $trProxy :: TypeRep (Proxy Type Int)
    $trProxy = TrApp $trProxyType $trInt TrType

    $tkProxy :: GHC.Types.KindRep
    $tkProxy = KindRepFun (KindRepVar 0)
                          (KindRepTyConApp (KindRepTYPE LiftedRep) [])

Note how $trProxyType cannot use 'TrApp', because TypeRep cannot represent
polymorphic types.  So instead

 * $trProxyType uses 'TrTyCon' to apply Proxy to (the representations)
   of all its kind arguments. We can't represent a tycon that is
   applied to only some of its kind arguments.

 * In $tcProxy, the GHC.Types.TyCon structure for Proxy, we store a
   GHC.Types.KindRep, which represents the polymorphic kind of Proxy
       Proxy :: forall k. k-&gt;Type

 * A KindRep is just a recipe that we can instantiate with the
   argument kinds, using Data.Typeable.Internal.tyConKind and
   store in the relevant 'TypeRep' constructor.

   Data.Typeable.Internal.typeRepKind looks up the stored kinds.

 * In a KindRep, the kind variables are represented by 0-indexed
   de Bruijn numbers:

    type KindBndr = Int   -- de Bruijn index

    data KindRep = KindRepTyConApp TyCon [KindRep]
                 | KindRepVar !KindBndr
                 | KindRepApp KindRep KindRep
                 | KindRepFun KindRep KindRep
                 ...

Note [Typeable instances for casted types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At present, GHC does not manufacture TypeReps for types containing casts
(#16835). In theory, GHC could do so today, but it might be dangerous tomorrow.

In today's GHC, we normalize all types before computing their TypeRep.
For example:

    type family F a
    type instance F Int = Type

    data D = forall (a :: F Int). MkD a

    tr :: TypeRep (MkD Bool)
    tr = typeRep

When computing the TypeRep for `MkD Bool` (or rather,
`MkD (Bool |&gt; Sym (FInt[0]))`), we simply discard the cast to obtain the
TypeRep for `MkD Bool`.

Why does this work? If we have a type definition with casts, then the
only coercions that those casts can mention are either Refl, type family
axioms, built-in axioms, and coercions built from those roots. Therefore,
type family (and built-in) axioms will apply precisely when type normalization
succeeds (i.e, the type family applications are reducible). Therefore, it
is safe to ignore the cast entirely when constructing the TypeRep.

This approach would be fragile in a future where GHC permits other forms of
coercions to appear in casts (e.g., coercion quantification as described
in #15710). If GHC permits local assumptions to appear in casts that cannot be
reduced with conventional normalization, then discarding casts would become
unsafe. It would be unfortunate for the Typeable solver to become a roadblock
obstructing such a future, so we deliberately do not implement the ability
for TypeReps to represent types with casts at the moment.

If we do wish to allow this in the future, it will likely require modeling
casts and coercions in TypeReps themselves.
-}</span><span>
</span><span id="line-750"></span><span>
</span><span id="line-751"></span><span class="annot"><a href="GHC.Tc.Instance.Typeable.html#mkList"><span class="hs-identifier hs-type">mkList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-752"></span><span id="mkList"><span class="annot"><span class="annottext">mkList :: Kind
-&gt; [LHsExpr (GhcPass 'Typechecked)]
-&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Tc.Instance.Typeable.html#mkList"><span class="hs-identifier hs-var hs-var">mkList</span></a></span></span><span> </span><span id="local-6989586621681106218"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106218"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LHsExpr (GhcPass 'Typechecked)
 -&gt; LHsExpr (GhcPass 'Typechecked)
 -&gt; LHsExpr (GhcPass 'Typechecked))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; [LHsExpr (GhcPass 'Typechecked)]
-&gt; LHsExpr (GhcPass 'Typechecked)
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106216"><span class="hs-identifier hs-var">consApp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106215"><span class="hs-identifier hs-var">nilExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106218"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-753"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-754"></span><span>    </span><span id="local-6989586621681106214"><span class="annot"><span class="annottext">cons :: LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106214"><span class="hs-identifier hs-var hs-var">cons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106213"><span class="hs-identifier hs-var">consExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106218"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-755"></span><span>    </span><span class="annot"><a href="#local-6989586621681106216"><span class="hs-identifier hs-type">consApp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-756"></span><span>    </span><span id="local-6989586621681106216"><span class="annot"><span class="annottext">consApp :: LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106216"><span class="hs-identifier hs-var hs-var">consApp</span></a></span></span><span> </span><span id="local-6989586621681106212"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106212"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681106211"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106211"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106214"><span class="hs-identifier hs-var">cons</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106212"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106211"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-757"></span><span>
</span><span id="line-758"></span><span>    </span><span class="annot"><a href="#local-6989586621681106215"><span class="hs-identifier hs-type">nilExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-759"></span><span>    </span><span id="local-6989586621681106215"><span class="annot"><span class="annottext">nilExpr :: Kind -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106215"><span class="hs-identifier hs-var hs-var">nilExpr</span></a></span></span><span> </span><span id="local-6989586621681106210"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106210"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#mkLHsWrap"><span class="hs-identifier hs-var">mkLHsWrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Kind] -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#mkWpTyApps"><span class="hs-identifier hs-var">mkWpTyApps</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106210"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#nilDataCon"><span class="hs-identifier hs-var">nilDataCon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-760"></span><span>
</span><span id="line-761"></span><span>    </span><span class="annot"><a href="#local-6989586621681106213"><span class="hs-identifier hs-type">consExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span>
</span><span id="line-762"></span><span>    </span><span id="local-6989586621681106213"><span class="annot"><span class="annottext">consExpr :: Kind -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681106213"><span class="hs-identifier hs-var hs-var">consExpr</span></a></span></span><span> </span><span id="local-6989586621681106208"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106208"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#mkLHsWrap"><span class="hs-identifier hs-var">mkLHsWrap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Kind] -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#mkWpTyApps"><span class="hs-identifier hs-var">mkWpTyApps</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681106208"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; LHsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#nlHsDataCon"><span class="hs-identifier hs-var">nlHsDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#consDataCon"><span class="hs-identifier hs-var">consDataCon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-763"></span></pre></body></html>